Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
ac5fda4d
Commit
ac5fda4d
authored
Oct 23, 2018
by
Zejun Lin
Committed by
fishyds
Oct 23, 2018
Browse files
add update trialNum and fix bugs (#261)
parent
30e23524
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
16 deletions
+29
-16
tools/nnicmd/nnictl.py
tools/nnicmd/nnictl.py
+4
-0
tools/nnicmd/updater.py
tools/nnicmd/updater.py
+25
-16
No files found.
tools/nnicmd/nnictl.py
View file @
ac5fda4d
...
...
@@ -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'
)
...
...
tools/nnicmd/updater.py
View file @
ac5fda4d
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment