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
67141400
Unverified
Commit
67141400
authored
Mar 23, 2022
by
J-shang
Committed by
GitHub
Mar 23, 2022
Browse files
Retry logic for getting experiment metadata failed (#4569)
parent
b0bcde86
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
nni/tools/nnictl/nnictl_utils.py
nni/tools/nnictl/nnictl_utils.py
+16
-3
No files found.
nni/tools/nnictl/nnictl_utils.py
View file @
67141400
...
...
@@ -222,9 +222,22 @@ def stop_experiment(args):
if
experiment_id_list
:
for
experiment_id
in
experiment_id_list
:
print_normal
(
'Stopping experiment %s'
%
experiment_id
)
experiments_config
=
Experiments
()
experiments_dict
=
experiments_config
.
get_all_experiments
()
rest_pid
=
experiments_dict
.
get
(
experiment_id
).
get
(
'pid'
)
# FIXME: Retry should be placed to `Experiments`, need review both python and ts code.
# retry up to 10 times to get the experiment metadata
for
i
in
range
(
1
,
11
):
experiments_dict
=
Experiments
().
get_all_experiments
()
experiment_info
=
experiments_dict
.
get
(
experiment_id
)
if
experiment_info
is
None
:
print_warning
(
'Get experiment {} metadata failed, {} time retry...'
.
format
(
experiment_id
,
i
))
time
.
sleep
(
0.5
)
else
:
break
if
experiment_info
is
None
:
print_error
(
'Experiment {} metadata getting failed.'
.
format
(
experiment_id
))
print_error
(
'The experiments metadata in `.experiment` is:'
)
print_error
(
json
.
dumps
(
Experiments
().
get_all_experiments
(),
indent
=
4
))
exit
(
1
)
rest_pid
=
experiment_info
.
get
(
'pid'
)
if
rest_pid
:
kill_command
(
rest_pid
)
print_normal
(
'Stop experiment success.'
)
...
...
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