From b693645fd0f6f27ac5d23ef25ae5a6c768378c79 Mon Sep 17 00:00:00 2001 From: chicm-ms <38930155+chicm-ms@users.noreply.github.com> Date: Tue, 25 Sep 2018 17:26:48 +0800 Subject: [PATCH] Merge master to dev-enas (#118) * update document (#92) * Edit readme.md * updated a word * Update GetStarted.md * Update GetStarted.md * refact readme, getstarted and write your trial md. * Update README.md * Update WriteYourTrial.md * Update WriteYourTrial.md * Update WriteYourTrial.md * Update WriteYourTrial.md * Fix nnictl bugs and add new feature (#75) * fix nnictl bug * fix nnictl create bug * add experiment status logic * add more information for nnictl * fix Evolution Tuner bug * refactor code * fix code in updater.py * fix nnictl --help * fix classArgs bug * update check response.status_code logic * remove Buffer warning (#100) * update readme in ga_squad * update readme * fix typo * Update README.md * Update README.md * Update README.md * Add support for debugging mode * fix setup.py (#115) * Add DAG model configuration format for SQuAD example. * Explain config format for SQuAD QA model. * Add more detailed introduction about the evolution algorithm. * Fix install.sh add add trial log path (#109) * fix nnictl bug * fix nnictl create bug * add experiment status logic * add more information for nnictl * fix Evolution Tuner bug * refactor code * fix code in updater.py * fix nnictl --help * fix classArgs bug * update check response.status_code logic * show trial log path * update document * fix install.sh * set default vallue for maxTrialNum and maxExecDuration * fix nnictl --- docs/NNICTLDOC.md | 15 +++++++++++++++ install.sh | 4 +++- tools/nnicmd/config_schema.py | 9 +++------ tools/nnicmd/launcher_utils.py | 5 +++++ tools/nnicmd/nnictl.py | 4 ++++ tools/nnicmd/nnictl_utils.py | 30 ++++++++++++++++++++++++++++++ 6 files changed, 60 insertions(+), 7 deletions(-) diff --git a/docs/NNICTLDOC.md b/docs/NNICTLDOC.md index 62e3dffe34..dadb3e5fb1 100644 --- a/docs/NNICTLDOC.md +++ b/docs/NNICTLDOC.md @@ -234,4 +234,19 @@ nnictl log | --head, -h| False| |show head lines of stderr| | --tail, -t| False| |show tail lines of stderr| | --path, -p| False| |show the path of stderr file| + +* __nnictl log trial__ + * Description + + Show trial log path. + + * Usage + + nnictl log trial [options] + + Options: + + | Name, shorthand | Required|Default | Description | + | ------ | ------ | ------ |------ | + | --id, -I| False| |the id of trial| \ No newline at end of file diff --git a/install.sh b/install.sh index 3d5199e187..ae83cefb7f 100644 --- a/install.sh +++ b/install.sh @@ -1,3 +1,5 @@ #!/bin/bash -make easy-install +make build +make install-dependencies +make dev-install source ~/.bashrc diff --git a/tools/nnicmd/config_schema.py b/tools/nnicmd/config_schema.py index 57b9fd14e8..dee8ce6564 100644 --- a/tools/nnicmd/config_schema.py +++ b/tools/nnicmd/config_schema.py @@ -25,8 +25,8 @@ 'authorName': str, 'experimentName': str, 'trialConcurrency': And(int, lambda n: 1 <=n <= 999999), -'maxExecDuration': Regex(r'^[1-9][0-9]*[s|m|h|d]$'), -'maxTrialNum': And(int, lambda x: 1 <= x <= 99999), +Optional('maxExecDuration'): Regex(r'^[1-9][0-9]*[s|m|h|d]$'), +Optional('maxTrialNum'): And(int, lambda x: 1 <= x <= 99999), 'trainingServicePlatform': And(str, lambda x: x in ['remote', 'local', 'pai']), Optional('searchSpacePath'): os.path.exists, 'useAnnotation': bool, @@ -41,10 +41,7 @@ 'codeDir': os.path.exists, 'classFileName': str, 'className': str, - Optional('classArgs'): { - Optional('optimize_mode'): Or('maximize', 'minimize'), - Optional('speed'): int - }, + Optional('classArgs'): dict, Optional('gpuNum'): And(int, lambda x: 0 <= x <= 99999), }), 'trial':{ diff --git a/tools/nnicmd/launcher_utils.py b/tools/nnicmd/launcher_utils.py index d9eb7347b8..600188d942 100644 --- a/tools/nnicmd/launcher_utils.py +++ b/tools/nnicmd/launcher_utils.py @@ -82,6 +82,11 @@ def validate_common_content(experiment_config): '''Validate whether the common values in experiment_config is valid''' try: CONFIG_SCHEMA.validate(experiment_config) + #set default value + if experiment_config.get('maxExecDuration') is None: + experiment_config['maxExecDuration'] = '999d' + if experiment_config.get('maxTrialNum') is None: + experiment_config['maxTrialNum'] = 99999 except Exception as exception: raise Exception(exception) diff --git a/tools/nnicmd/nnictl.py b/tools/nnicmd/nnictl.py index 9762ca82c6..b688a92235 100644 --- a/tools/nnicmd/nnictl.py +++ b/tools/nnicmd/nnictl.py @@ -118,6 +118,10 @@ def parse_args(): parser_log_stderr.add_argument('--head', '-H', dest='head', type=int, help='get head -100 content of stderr') parser_log_stderr.add_argument('--path', '-p', 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', '-I', dest='id', help='find trial log path by id') + parser_log_trial.set_defaults(func=log_trial) + args = parser.parse_args() args.func(args) diff --git a/tools/nnicmd/nnictl_utils.py b/tools/nnicmd/nnictl_utils.py index 7305df0980..2b7628ec67 100644 --- a/tools/nnicmd/nnictl_utils.py +++ b/tools/nnicmd/nnictl_utils.py @@ -175,6 +175,36 @@ def log_stderr(args): '''get stderr log''' log_internal(args, 'stderr') +def log_trial(args): + ''''get trial log path''' + trial_id_path_dict = {} + nni_config = Config() + rest_port = nni_config.get_config('restServerPort') + rest_pid = nni_config.get_config('restServerPid') + if not detect_process(rest_pid): + print_error('Experiment is not running...') + return + running, response = check_rest_server_quick(rest_port) + if running: + response = rest_get(trial_jobs_url(rest_port), 20) + if response and check_response(response): + content = json.loads(response.text) + for trial in content: + trial_id_path_dict[trial['id']] = trial['logPath'] + else: + print_error('Restful server is not running...') + exit(0) + if args.id: + if trial_id_path_dict.get(args.id): + print('id:' + args.id + ' path:' + trial_id_path_dict[args.id]) + else: + print_error('trial id is not valid!') + exit(0) + else: + for key in trial_id_path_dict.keys(): + print('id:' + key + ' path:' + trial_id_path_dict[key]) + + def get_config(args): '''get config info''' nni_config = Config()