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

add update trialNum and fix bugs #261

Merged
merged 1 commit into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tools/nnicmd/nnictl.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ def parse_args():
parser_updater_duration.add_argument('--id', '-i', dest='id', help='the id of experiment')
parser_updater_duration.add_argument('--value', '-v', required=True)
parser_updater_duration.set_defaults(func=update_duration)
parser_updater_trialnum = parser_updater_subparsers.add_parser('trialnum', help='update maxtrialnum')
parser_updater_trialnum.add_argument('--id', '-i', dest='id', help='the id of experiment')
parser_updater_trialnum.add_argument('--value', '-v', required=True)
parser_updater_trialnum.set_defaults(func=update_trialnum)

#parse stop command
parser_stop = subparsers.add_parser('stop', help='stop the experiment')
Expand Down
41 changes: 25 additions & 16 deletions tools/nnicmd/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from .url_utils import experiment_url
from .config_utils import Config
from .common_utils import get_json_content
from .nnictl_utils import get_experiment_port

def validate_digit(value, start, end):
'''validate if a digit is valid'''
Expand Down Expand Up @@ -74,28 +75,36 @@ def update_experiment_profile(args, key, value):
def update_searchspace(args):
validate_file(args.filename)
content = load_search_space(args.filename)
if update_experiment_profile(args, 'searchSpace', content):
print('INFO: update %s success!' % 'searchSpace')
else:
print('ERROR: update %s failed!' % 'searchSpace')
args.port = get_experiment_port(args)
if args.port is not None:
if update_experiment_profile(args, 'searchSpace', content):
print('INFO: update %s success!' % 'searchSpace')
else:
print('ERROR: update %s failed!' % 'searchSpace')

def update_concurrency(args):
validate_digit(args.value, 1, 1000)
if update_experiment_profile(args, 'trialConcurrency', int(args.value)):
print('INFO: update %s success!' % 'concurrency')
else:
print('ERROR: update %s failed!' % 'concurrency')
args.port = get_experiment_port(args)
if args.port is not None:
if update_experiment_profile(args, 'trialConcurrency', int(args.value)):
print('INFO: update %s success!' % 'concurrency')
else:
print('ERROR: update %s failed!' % 'concurrency')

def update_duration(args):
validate_digit(args.value, 1, 999999999)
if update_experiment_profile(args, 'maxExecDuration', int(args.value)):
print('INFO: update %s success!' % 'duration')
else:
print('ERROR: update %s failed!' % 'duration')
args.port = get_experiment_port(args)
if args.port is not None:
if update_experiment_profile(args, 'maxExecDuration', int(args.value)):
print('INFO: update %s success!' % 'duration')
else:
print('ERROR: update %s failed!' % 'duration')

def update_trialnum(args):
validate_digit(args.value, 1, 999999999)
if update_experiment_profile('maxTrialNum', int(args.value)):
print('INFO: update %s success!' % 'trialnum')
else:
print('ERROR: update %s failed!' % 'trialnum')
args.port = get_experiment_port(args)
if args.port is not None:
if update_experiment_profile(args, 'maxTrialNum', int(args.value)):
print('INFO: update %s success!' % 'trialnum')
else:
print('ERROR: update %s failed!' % 'trialnum')