Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Merge .config & nni.sqlite #3309

Merged
merged 14 commits into from
Jan 24, 2021
Merged

Merge .config & nni.sqlite #3309

merged 14 commits into from
Jan 24, 2021

Conversation

J-shang
Copy link
Contributor

@J-shang J-shang commented Jan 15, 2021

No description provided.

break
elif not args.searchSpacePath:
print_warning('%s exist, will not load search_space file' % target_path)
# archive_search_space_dir = os.path.join(temp_root_dir, 'searchSpace')
Copy link
Contributor

@SparkSnail SparkSnail Jan 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why annotate them? If these code are not used anymore, you could delete them directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, search space file does not need a copy anymore, have deleted them.

from .command_utils import print_error
from .common_utils import get_file_lock

def config_v0_to_v1(config: dict) -> dict:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does v0 mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v0 means the config format in nni.sqlite (clusterMetaData), will be deprecated soon.

'''refresh to get latest config'''
sql = 'select * from ExperimentProfile where id=? order by revision DESC'
args = (self.experiment_id,)
self.config = config_v0_to_v1(json.loads(self.cursor.execute(sql, args).fetchall()[0][0]))
Copy link
Contributor

@liuzhe-lz liuzhe-lz Jan 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Don't use self.cursor. One cursor per query to avoid potential racing.
  2. select COLUMN_NAME should be preferred over select *, in case the table is altered in future.
  3. .fetchall()[0] should be .fetchone()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

@@ -624,26 +618,25 @@ def create_experiment(args):
def manage_stopped_experiment(args, mode):
'''view a stopped experiment'''
update_experiment()
experiment_config = Experiments()
experiment_dict = experiment_config.get_all_experiments()
experiments_config = Experiments()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally suggest rename "config" to "metadata" or "metainfo".
Not mandatory if you think "config" is better.

@J-shang J-shang merged commit e6629a7 into microsoft:master Jan 24, 2021
@J-shang J-shang deleted the merge-config branch March 1, 2021 03:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants