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
59ce65c5
Unverified
Commit
59ce65c5
authored
Sep 16, 2019
by
SparkSnail
Committed by
GitHub
Sep 16, 2019
Browse files
fix nnictl log trial bug (#1550)
parent
55f48d27
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
tools/nni_cmd/nnictl_utils.py
tools/nni_cmd/nnictl_utils.py
+15
-10
No files found.
tools/nni_cmd/nnictl_utils.py
View file @
59ce65c5
...
@@ -351,6 +351,7 @@ def log_stderr(args):
...
@@ -351,6 +351,7 @@ def log_stderr(args):
def
log_trial
(
args
):
def
log_trial
(
args
):
''''get trial log path'''
''''get trial log path'''
trial_id_path_dict
=
{}
trial_id_path_dict
=
{}
trial_id_list
=
[]
nni_config
=
Config
(
get_config_filename
(
args
))
nni_config
=
Config
(
get_config_filename
(
args
))
rest_port
=
nni_config
.
get_config
(
'restServerPort'
)
rest_port
=
nni_config
.
get_config
(
'restServerPort'
)
rest_pid
=
nni_config
.
get_config
(
'restServerPid'
)
rest_pid
=
nni_config
.
get_config
(
'restServerPid'
)
...
@@ -363,23 +364,27 @@ def log_trial(args):
...
@@ -363,23 +364,27 @@ def log_trial(args):
if
response
and
check_response
(
response
):
if
response
and
check_response
(
response
):
content
=
json
.
loads
(
response
.
text
)
content
=
json
.
loads
(
response
.
text
)
for
trial
in
content
:
for
trial
in
content
:
trial_id_path_dict
[
trial
[
'id'
]]
=
trial
[
'logPath'
]
trial_id_list
.
append
(
trial
.
get
(
'id'
))
if
trial
.
get
(
'logPath'
):
trial_id_path_dict
[
trial
.
get
(
'id'
)]
=
trial
[
'logPath'
]
else
:
else
:
print_error
(
'Restful server is not running...'
)
print_error
(
'Restful server is not running...'
)
exit
(
1
)
exit
(
1
)
if
args
.
id
:
if
args
.
trial_id
:
if
args
.
trial_id
:
if
args
.
trial_id
not
in
trial_id_list
:
if
trial_id_path_dict
.
get
(
args
.
trial_id
):
print_error
(
'Trial id {0} not correct, please check your command!'
.
format
(
args
.
trial_id
))
print_normal
(
'id:'
+
args
.
trial_id
+
' path:'
+
trial_id_path_dict
[
args
.
trial_id
])
exit
(
1
)
else
:
if
trial_id_path_dict
.
get
(
args
.
trial_id
):
print_error
(
'trial id is not valid.'
)
print_normal
(
'id:'
+
args
.
trial_id
+
' path:'
+
trial_id_path_dict
[
args
.
trial_id
])
exit
(
1
)
else
:
else
:
print_error
(
'
please specific the trial id
.'
)
print_error
(
'
Log path is not available yet, please wait..
.'
)
exit
(
1
)
exit
(
1
)
else
:
else
:
print_normal
(
'All of trial log info:'
)
for
key
in
trial_id_path_dict
:
for
key
in
trial_id_path_dict
:
print
(
'id:'
+
key
+
' path:'
+
trial_id_path_dict
[
key
])
print_normal
(
'id:'
+
key
+
' path:'
+
trial_id_path_dict
[
key
])
if
not
trial_id_path_dict
:
print_normal
(
'None'
)
def
get_config
(
args
):
def
get_config
(
args
):
'''get config info'''
'''get config info'''
...
...
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