-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Conversation
nni/tools/nnictl/nnictl_utils.py
Outdated
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') |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does v0
mean?
There was a problem hiding this comment.
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.
nni/tools/nnictl/config_utils.py
Outdated
'''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])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Don't use
self.cursor
. One cursor per query to avoid potential racing. select COLUMN_NAME
should be preferred overselect *
, in case the table is altered in future..fetchall()[0]
should be.fetchone()
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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.
No description provided.