Commit 36401157 authored by Lee's avatar Lee Committed by xuehui
Browse files

Change the behavior of `nnictl log trial [--trialid TRIALID] [id]` (#900)

* add different tuner config files for config_test

* change MetisTuner config test due to no lightgbm python module in integration test

* install smac package in azure-pipelines

* SMAC need swig to be installed

* Try to install swig from source code

* remove SMAC test because the dependency can not be installed

* use sudo to install the swig

* sleep 10s to make sure the port has been released

* remove tuner test for networkmorphism because it uses more than 30s to release the tcp port

* word "down" to "done"

* add config test for Curvefitting assessor

* change file name

* Fix data type not match bug

* Optimize MetisTunner

* pretty the code

* Follow the review comment

* add exploration probability

* Avoid None type object generating

* fix nnictl log trial bug

* rollback chinese doc

* add argument 'experiment' to parser_log_trial and parser_trial_kill

* update doc
parent c29a0cc3
......@@ -207,8 +207,8 @@ nnictl support commands:
|Name, shorthand|Required|Default|Description|
|------|------|------ |------|
|id| False| |ID of the experiment you want to set|
|--trialid, -t| True| |ID of the trial you want to kill.|
|id| False| |ID of the trial to be killed|
|--experiment, -E| True| |Experiment id of the trial|
<a name="top"></a>
* __nnictl top__
......@@ -354,7 +354,8 @@ nnictl support commands:
|Name, shorthand|Required|Default|Description|
|------|------|------ |------|
|id| False| |the id of trial|
|id| False| |ID of the trial to be found the log path|
|--experiment, -E| False| |Experiment ID of the trial, required when id is not empty.|
<a name="webui"></a>
### Manage webui
......
......@@ -98,8 +98,8 @@ def parse_args():
parser_trial_ls.add_argument('id', nargs='?', help='the id of experiment')
parser_trial_ls.set_defaults(func=trial_ls)
parser_trial_kill = parser_trial_subparsers.add_parser('kill', help='kill trial jobs')
parser_trial_kill.add_argument('id', nargs='?', help='the id of experiment')
parser_trial_kill.add_argument('--trialid', '-t', required=True, dest='trialid', help='the id of trial to be killed')
parser_trial_kill.add_argument('id', nargs='?', help='id of the trial to be killed')
parser_trial_kill.add_argument('--experiment', '-E', required=True, dest='experiment', help='experiment id of the trial')
parser_trial_kill.set_defaults(func=trial_kill)
#parse experiment command
......@@ -149,8 +149,8 @@ def parse_args():
parser_log_stderr.add_argument('--path', action='store_true', default=False, help='get the path of stderr file')
parser_log_stderr.set_defaults(func=log_stderr)
parser_log_trial = parser_log_subparsers.add_parser('trial', help='get trial log path')
parser_log_trial.add_argument('id', nargs='?', help='the id of experiment')
parser_log_trial.add_argument('--trialid', '-T', dest='trialid', help='find trial log path by id')
parser_log_trial.add_argument('id', nargs='?', help='id of the trial to be found the log path')
parser_log_trial.add_argument('--experiment', '-E', dest='experiment', help='experiment id of the trial, xperiment ID of the trial, required when id is not empty.')
parser_log_trial.set_defaults(func=log_trial)
#parse package command
......
......@@ -76,9 +76,12 @@ def check_experiment_id(args):
return None
else:
return running_experiment_list[0]
if hasattr(args, "experiment"):
if experiment_dict.get(args.experiment):
return args.experiment
elif hasattr(args, "id"):
if experiment_dict.get(args.id):
return args.id
else:
print_error('Id not correct!')
return None
......@@ -239,7 +242,7 @@ def trial_kill(args):
return
running, _ = check_rest_server_quick(rest_port)
if running:
response = rest_delete(trial_job_id_url(rest_port, args.trialid), 20)
response = rest_delete(trial_job_id_url(rest_port, args.id), 20)
if response and check_response(response):
print(response.text)
else:
......@@ -327,6 +330,7 @@ def log_trial(args):
else:
print_error('Restful server is not running...')
exit(1)
if args.experiment:
if args.id:
if trial_id_path_dict.get(args.id):
print('id:' + args.id + ' path:' + trial_id_path_dict[args.id])
......@@ -334,7 +338,11 @@ def log_trial(args):
print_error('trial id is not valid!')
exit(1)
else:
for key in trial_id_path_dict.keys():
print_error('please specific the trial id!')
print_error("trial id list in this experiment: " + str(list(trial_id_path_dict.keys())))
exit(1)
else:
for key in trial_id_path_dict:
print('id:' + key + ' path:' + trial_id_path_dict[key])
def get_config(args):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment