Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove user as an index for Experiment #264

Merged
merged 3 commits into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/orion/core/worker/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def __init__(self, name, user=None, version=None):
# this needs to be an attribute because we override it in ExperienceView
self._storage = get_storage()

config = self._storage.fetch_experiments({'name': name, 'metadata.user': user})
config = self._storage.fetch_experiments({'name': name})

if config:
log.debug("Found existing experiment, %s, under user, %s, registered in database.",
Expand Down
1 change: 0 additions & 1 deletion src/orion/storage/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def _setup_db(self):
"""Database index setup"""
self._db.ensure_index('experiments',
[('name', Database.ASCENDING),
('metadata.user', Database.ASCENDING),
('version', Database.ASCENDING)],
unique=True)
self._db.ensure_index('experiments', 'metadata.datetime')
Expand Down
6 changes: 3 additions & 3 deletions tests/unittests/core/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,16 @@ def hacked_exp(with_user_dendi, random_dt, clean_db, create_db_instance):
"""Return an `Experiment` instance with hacked _id to find trials in
fake database.
"""
exp = Experiment('supernaedo2')
exp._id = 'supernaedo2' # white box hack
exp = Experiment('supernaedo2-dendi')
exp._id = 'supernaedo2-dendi' # white box hack
return exp


@pytest.fixture()
def trial_id_substitution(with_user_tsirif, random_dt, clean_db, create_db_instance):
"""Replace trial ids by the actual ids of the experiments."""
db = create_db_instance
experiments = db.read('experiments', {'metadata.user': 'tsirif'})
experiments = db.read('experiments', {})
experiment_dict = dict((experiment['name'], experiment) for experiment in experiments)
trials = db.read('trials')

Expand Down
100 changes: 50 additions & 50 deletions tests/unittests/core/experiment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,38 @@
# Example of entries in `experiments` collection
# configurations: some are inferred automatically,
# but most depend on user's input to `orion`
- name: supernaedo2-dendi

metadata:
user: dendi
datetime: 2017-11-22T20:00:00
orion_version: XYZ
user_script: functional/demo/black_box.py
user_args: ["--encoding_layer~choices(['rnn', 'lstm', 'gru'])", "--decoding_layer~choices(['rnn', 'lstm_with_attention', 'gru'])"]
VCS:
type: git
is_dirty: False
HEAD_sha: "test"
active_branch: null
diff_sha: "diff"
refers:
root_id: supernaedo2-dendi
parent_id: null
adapter: []
pool_size: 2
max_trials: 1000
working_dir:
algorithms:
dumbalgo: # this must be logged as `Experiment` would log it, complete specification
seed: null
value: 5
scoring: 0
judgement: ~
suspend: False
done: False
producer:
strategy: NoParallelStrategy

- name: supernaedo2

metadata:
Expand Down Expand Up @@ -117,38 +149,6 @@
producer:
strategy: NoParallelStrategy

- name: supernaedo2

metadata:
user: dendi
datetime: 2017-11-22T20:00:00
orion_version: XYZ
user_script: full_path/main.py
user_args: ["--encoding_layer~choices(['rnn', 'lstm', 'gru'])", "--decoding_layer~choices(['rnn', 'lstm_with_attention', 'gru'])"]
VCS:
type: git
is_dirty: False
HEAD_sha: "as5f7asf5asfa7sf"
active_branch: null
diff_sha: "diff"
refers:
root_id: supernaedo2
parent_id: null
adapter: []
pool_size: 2
max_trials: 1000
working_dir:
algorithms:
dumbalgo: # this must be logged as `Experiment` would log it, complete specification
seed: null
value: 5
scoring: 0
judgement: ~
suspend: False
done: False
producer:
strategy: NoParallelStrategy


- name: supernaedo2.1

Expand All @@ -171,8 +171,8 @@
diff_sha: "diff"

refers:
root_id: supernaedo2
parent_id: supernaedo2
root_id: supernaedo2-dendi
parent_id: supernaedo2-dendi
adapter:
- of_type: dimensiondeletion
param:
Expand Down Expand Up @@ -215,8 +215,8 @@
diff_sha: "diff"

refers:
root_id: supernaedo2
parent_id: supernaedo2
root_id: supernaedo2-dendi
parent_id: supernaedo2-dendi
adapter:
- of_type: dimensiondeletion
param:
Expand Down Expand Up @@ -259,8 +259,8 @@
diff_sha: "diff"

refers:
root_id: supernaedo2
parent_id: supernaedo2
root_id: supernaedo2-dendi
parent_id: supernaedo2-dendi
adapter:
- of_type: dimensionrenaming
old_name: /encoding_layer
Expand Down Expand Up @@ -301,7 +301,7 @@
diff_sha: "diff"

refers:
root_id: supernaedo2
root_id: supernaedo2-dendi
parent_id: supernaedo2.3
adapter:
- of_type: dimensiondeletion
Expand Down Expand Up @@ -349,7 +349,7 @@
diff_sha: "diff"

refers:
root_id: supernaedo2
root_id: supernaedo2-dendi
parent_id: supernaedo2.3.1
adapter:
- of_type: codechange
Expand Down Expand Up @@ -390,7 +390,7 @@
diff_sha: "diff"

refers:
root_id: supernaedo2
root_id: supernaedo2-dendi
parent_id: supernaedo2.3.1
adapter:
- of_type: codechange
Expand Down Expand Up @@ -431,7 +431,7 @@
diff_sha: "diff"

refers:
root_id: supernaedo2
root_id: supernaedo2-dendi
parent_id: supernaedo2.3.1
adapter:
- of_type: codechange
Expand Down Expand Up @@ -472,7 +472,7 @@
diff_sha: "diff"

refers:
root_id: supernaedo2
root_id: supernaedo2-dendi
parent_id: supernaedo2.2
adapter:
- of_type: algorithmchange
Expand All @@ -492,7 +492,7 @@
---

# Example of entries in `trials` collection
- experiment: supernaedo2
- experiment: supernaedo2-dendi

status: completed # new, reserved, suspended, completed, interrupted, broken
worker: 1251231
Expand All @@ -511,7 +511,7 @@
type: categorical
value: lstm
parents: []
- experiment: supernaedo2
- experiment: supernaedo2-dendi

status: completed
worker: 23415151
Expand All @@ -537,7 +537,7 @@
value: gru
parents: []

- experiment: supernaedo2
- experiment: supernaedo2-dendi

status: completed
worker: 1251231
Expand All @@ -561,7 +561,7 @@
parents: []


- experiment: supernaedo2
- experiment: supernaedo2-dendi

status: new
worker: ~
Expand All @@ -581,7 +581,7 @@
value: gru
parents: []

- experiment: supernaedo2
- experiment: supernaedo2-dendi

status: new # new, reserved, suspended, completed, broken
worker: ~
Expand All @@ -600,7 +600,7 @@
type: categorical
value: rnn
parents: []
- experiment: supernaedo2
- experiment: supernaedo2-dendi

status: interrupted
worker: ~
Expand All @@ -619,7 +619,7 @@
type: categorical
value: lstm
parents: []
- experiment: supernaedo2
- experiment: supernaedo2-dendi

status: suspended
worker: ~
Expand Down
2 changes: 2 additions & 0 deletions tests/unittests/core/io/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def child_config(parent_config):
@pytest.fixture
def experiment_name_conflict(create_db_instance, parent_config, child_config):
"""Generate an experiment name conflict"""
create_db_instance.remove('experiments', {'name': 'test'})
create_db_instance.remove('experiments', {'name': 'test2'})
create_db_instance.write('experiments', parent_config)
create_db_instance.write('experiments', child_config)
return conflicts.ExperimentNameConflict(parent_config, parent_config)
2 changes: 1 addition & 1 deletion tests/unittests/core/io/database_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_read(self, create_db_instance):
database = create_db_instance
readonly_database = ReadOnlyDB(database)

args = {"collection_name": "trials", "query": {"experiment": "supernaedo2"}}
args = {"collection_name": "trials", "query": {"experiment": "supernaedo2-dendi"}}
readonly_result = readonly_database.read(**args)
result = database.read(**args)

Expand Down
Loading