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
ba5d18c4
Unverified
Commit
ba5d18c4
authored
Feb 27, 2020
by
SparkSnail
Committed by
GitHub
Feb 27, 2020
Browse files
Handle exception and kill restserver in nnictl (#2086)
parent
ff2728c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
tools/nni_cmd/launcher.py
tools/nni_cmd/launcher.py
+18
-2
No files found.
tools/nni_cmd/launcher.py
View file @
ba5d18c4
...
@@ -525,7 +525,15 @@ def create_experiment(args):
...
@@ -525,7 +525,15 @@ def create_experiment(args):
nni_config
.
set_config
(
'experimentConfig'
,
experiment_config
)
nni_config
.
set_config
(
'experimentConfig'
,
experiment_config
)
nni_config
.
set_config
(
'restServerPort'
,
args
.
port
)
nni_config
.
set_config
(
'restServerPort'
,
args
.
port
)
launch_experiment
(
args
,
experiment_config
,
'new'
,
config_file_name
)
try
:
launch_experiment
(
args
,
experiment_config
,
'new'
,
config_file_name
)
except
Exception
as
exception
:
nni_config
=
Config
(
config_file_name
)
restServerPid
=
nni_config
.
get_config
(
'restServerPid'
)
if
restServerPid
:
kill_command
(
restServerPid
)
print_error
(
exception
)
exit
(
1
)
def
manage_stopped_experiment
(
args
,
mode
):
def
manage_stopped_experiment
(
args
,
mode
):
'''view a stopped experiment'''
'''view a stopped experiment'''
...
@@ -553,8 +561,16 @@ def manage_stopped_experiment(args, mode):
...
@@ -553,8 +561,16 @@ def manage_stopped_experiment(args, mode):
new_config_file_name
=
''
.
join
(
random
.
sample
(
string
.
ascii_letters
+
string
.
digits
,
8
))
new_config_file_name
=
''
.
join
(
random
.
sample
(
string
.
ascii_letters
+
string
.
digits
,
8
))
new_nni_config
=
Config
(
new_config_file_name
)
new_nni_config
=
Config
(
new_config_file_name
)
new_nni_config
.
set_config
(
'experimentConfig'
,
experiment_config
)
new_nni_config
.
set_config
(
'experimentConfig'
,
experiment_config
)
launch_experiment
(
args
,
experiment_config
,
mode
,
new_config_file_name
,
experiment_id
)
new_nni_config
.
set_config
(
'restServerPort'
,
args
.
port
)
new_nni_config
.
set_config
(
'restServerPort'
,
args
.
port
)
try
:
launch_experiment
(
args
,
experiment_config
,
mode
,
new_config_file_name
,
experiment_id
)
except
Exception
as
exception
:
nni_config
=
Config
(
new_config_file_name
)
restServerPid
=
nni_config
.
get_config
(
'restServerPid'
)
if
restServerPid
:
kill_command
(
restServerPid
)
print_error
(
exception
)
exit
(
1
)
def
view_experiment
(
args
):
def
view_experiment
(
args
):
'''view a stopped experiment'''
'''view a stopped experiment'''
...
...
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