Commit ac5fda4d authored by Zejun Lin's avatar Zejun Lin Committed by fishyds
Browse files

add update trialNum and fix bugs (#261)

parent 30e23524
......@@ -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')
......
......@@ -25,6 +25,7 @@ from .rest_utils import rest_put, rest_get, check_rest_server_quick, check_respo
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'''
......@@ -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')
\ No newline at end of file
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')
\ No newline at end of file
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