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
"docs/en_US/git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "98e86841cea50c1e0183d2c96be23507562c029f"
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
Show 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():
...
@@ -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
(
'--id'
,
'-i'
,
dest
=
'id'
,
help
=
'the id of experiment'
)
parser_updater_duration
.
add_argument
(
'--value'
,
'-v'
,
required
=
True
)
parser_updater_duration
.
add_argument
(
'--value'
,
'-v'
,
required
=
True
)
parser_updater_duration
.
set_defaults
(
func
=
update_duration
)
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
#parse stop command
parser_stop
=
subparsers
.
add_parser
(
'stop'
,
help
=
'stop the experiment'
)
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
...
@@ -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
.url_utils
import
experiment_url
from
.config_utils
import
Config
from
.config_utils
import
Config
from
.common_utils
import
get_json_content
from
.common_utils
import
get_json_content
from
.nnictl_utils
import
get_experiment_port
def
validate_digit
(
value
,
start
,
end
):
def
validate_digit
(
value
,
start
,
end
):
'''validate if a digit is valid'''
'''validate if a digit is valid'''
...
@@ -74,6 +75,8 @@ def update_experiment_profile(args, key, value):
...
@@ -74,6 +75,8 @@ def update_experiment_profile(args, key, value):
def
update_searchspace
(
args
):
def
update_searchspace
(
args
):
validate_file
(
args
.
filename
)
validate_file
(
args
.
filename
)
content
=
load_search_space
(
args
.
filename
)
content
=
load_search_space
(
args
.
filename
)
args
.
port
=
get_experiment_port
(
args
)
if
args
.
port
is
not
None
:
if
update_experiment_profile
(
args
,
'searchSpace'
,
content
):
if
update_experiment_profile
(
args
,
'searchSpace'
,
content
):
print
(
'INFO: update %s success!'
%
'searchSpace'
)
print
(
'INFO: update %s success!'
%
'searchSpace'
)
else
:
else
:
...
@@ -81,6 +84,8 @@ def update_searchspace(args):
...
@@ -81,6 +84,8 @@ def update_searchspace(args):
def
update_concurrency
(
args
):
def
update_concurrency
(
args
):
validate_digit
(
args
.
value
,
1
,
1000
)
validate_digit
(
args
.
value
,
1
,
1000
)
args
.
port
=
get_experiment_port
(
args
)
if
args
.
port
is
not
None
:
if
update_experiment_profile
(
args
,
'trialConcurrency'
,
int
(
args
.
value
)):
if
update_experiment_profile
(
args
,
'trialConcurrency'
,
int
(
args
.
value
)):
print
(
'INFO: update %s success!'
%
'concurrency'
)
print
(
'INFO: update %s success!'
%
'concurrency'
)
else
:
else
:
...
@@ -88,6 +93,8 @@ def update_concurrency(args):
...
@@ -88,6 +93,8 @@ def update_concurrency(args):
def
update_duration
(
args
):
def
update_duration
(
args
):
validate_digit
(
args
.
value
,
1
,
999999999
)
validate_digit
(
args
.
value
,
1
,
999999999
)
args
.
port
=
get_experiment_port
(
args
)
if
args
.
port
is
not
None
:
if
update_experiment_profile
(
args
,
'maxExecDuration'
,
int
(
args
.
value
)):
if
update_experiment_profile
(
args
,
'maxExecDuration'
,
int
(
args
.
value
)):
print
(
'INFO: update %s success!'
%
'duration'
)
print
(
'INFO: update %s success!'
%
'duration'
)
else
:
else
:
...
@@ -95,7 +102,9 @@ def update_duration(args):
...
@@ -95,7 +102,9 @@ def update_duration(args):
def
update_trialnum
(
args
):
def
update_trialnum
(
args
):
validate_digit
(
args
.
value
,
1
,
999999999
)
validate_digit
(
args
.
value
,
1
,
999999999
)
if
update_experiment_profile
(
'maxTrialNum'
,
int
(
args
.
value
)):
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'
)
print
(
'INFO: update %s success!'
%
'trialnum'
)
else
:
else
:
print
(
'ERROR: update %s failed!'
%
'trialnum'
)
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