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

Commit

Permalink
Inform users to set experiment id when id is empty (#310)
Browse files Browse the repository at this point in the history
* fix nnictl bug

* fix install.sh

* add desc for Dockerfile.build.base

* update document for Dockerfile

* update

* refactor port detect

* update

* refactor NNICTLDOC.md

* add document for pai and nnictl

* add default value for port

* add exception handling in trial_keeper.py

* fix port bug

* fix resume

* fix nnictl resume and fix nnictl stop

* fix document

* update

* refactor nnictl

* update

* update doc

* update

* update nnictl

* fix comment

* revert dockerfile

* update

* update

* update

* fix nnictl error hit

* fix comments

* fix bash-completion

* fix paramiko install

* quick fix resume logic

* update

* quick fix nnictl

* fix nnictl crash bug

* add requirement.txt for sklearn example

* fix nnictl configuration bug

* update

* update

* update

* update

* remove paramiko

* refactor nnictl lfor log stdout

* update

* updaate
  • Loading branch information
SparkSnail authored and chicm-ms committed Nov 2, 2018
1 parent efb1bd0 commit 9735b64
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions tools/nnicmd/nnictl_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def check_experiment_id(args):
experiment_dict = experiment_config.get_all_experiments()
if not experiment_dict:
print_normal('There is no experiment running...')
exit(1)
return None
if not args.id:
running_experiment_list = []
for key in experiment_dict.keys():
Expand All @@ -58,14 +58,14 @@ def check_experiment_id(args):
exit(1)
elif not running_experiment_list:
print_error('There is no experiment running!')
exit(1)
return None
else:
return running_experiment_list[0]
if experiment_dict.get(args.id):
return args.id
else:
print_error('Id not correct!')
exit(1)
return None

def parse_ids(args):
'''Parse the arguments for nnictl stop
Expand Down Expand Up @@ -116,20 +116,28 @@ def parse_ids(args):
if len(result_list) > 1:
print_error(args.id + ' is ambiguous, please choose ' + ' '.join(result_list) )
return None
if not result_list:
print_error('There are no experiments matched, please check experiment id...')
if not result_list and args.id:
print_error('There are no experiments matched, please set correct experiment id...')
elif not result_list:
print_error('There is no experiment running...')
return result_list

def get_config_filename(args):
'''get the file name of config file'''
experiment_id = check_experiment_id(args)
if experiment_id is None:
print_error('Please set the experiment id!')
exit(1)
experiment_config = Experiments()
experiment_dict = experiment_config.get_all_experiments()
return experiment_dict[experiment_id]['fileName']

def get_experiment_port(args):
'''get the port of experiment'''
experiment_id = check_experiment_id(args)
if experiment_id is None:
print_error('Please set the experiment id!')
exit(1)
experiment_config = Experiments()
experiment_dict = experiment_config.get_all_experiments()
return experiment_dict[experiment_id]['port']
Expand Down

0 comments on commit 9735b64

Please sign in to comment.