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
9efce4fe
"git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "56c6cfeaedfb6f3f96d1a4ef5099c3d121efadea"
Unverified
Commit
9efce4fe
authored
Mar 27, 2020
by
SparkSnail
Committed by
GitHub
Mar 27, 2020
Browse files
Support tensorboard 2.x command (#2242)
parent
39cd591b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
tools/nni_cmd/common_utils.py
tools/nni_cmd/common_utils.py
+8
-0
tools/nni_cmd/tensorboard_utils.py
tools/nni_cmd/tensorboard_utils.py
+3
-2
No files found.
tools/nni_cmd/common_utils.py
View file @
9efce4fe
...
@@ -76,6 +76,14 @@ def get_python_dir(sitepackages_path):
...
@@ -76,6 +76,14 @@ def get_python_dir(sitepackages_path):
else
:
else
:
return
str
(
Path
(
sitepackages_path
).
parents
[
2
])
return
str
(
Path
(
sitepackages_path
).
parents
[
2
])
def
check_tensorboard_version
():
try
:
import
tensorboard
return
tensorboard
.
__version__
except
:
print_error
(
'import tensorboard error!'
)
exit
(
1
)
def
get_nni_installation_path
():
def
get_nni_installation_path
():
''' Find nni lib from the following locations in order
''' Find nni lib from the following locations in order
Return nni root directory if it exists
Return nni root directory if it exists
...
...
tools/nni_cmd/tensorboard_utils.py
View file @
9efce4fe
...
@@ -10,7 +10,7 @@ from .rest_utils import rest_get, check_rest_server_quick, check_response
...
@@ -10,7 +10,7 @@ from .rest_utils import rest_get, check_rest_server_quick, check_response
from
.config_utils
import
Config
,
Experiments
from
.config_utils
import
Config
,
Experiments
from
.url_utils
import
trial_jobs_url
,
get_local_urls
from
.url_utils
import
trial_jobs_url
,
get_local_urls
from
.constants
import
COLOR_GREEN_FORMAT
,
REST_TIME_OUT
from
.constants
import
COLOR_GREEN_FORMAT
,
REST_TIME_OUT
from
.common_utils
import
print_normal
,
print_error
,
detect_process
,
detect_port
from
.common_utils
import
print_normal
,
print_error
,
detect_process
,
detect_port
,
check_tensorboard_version
from
.nnictl_utils
import
check_experiment_id
,
check_experiment_id
from
.nnictl_utils
import
check_experiment_id
,
check_experiment_id
from
.ssh_utils
import
create_ssh_sftp_client
,
copy_remote_directory_to_local
from
.ssh_utils
import
create_ssh_sftp_client
,
copy_remote_directory_to_local
...
@@ -77,7 +77,8 @@ def start_tensorboard_process(args, nni_config, path_list, temp_nni_path):
...
@@ -77,7 +77,8 @@ def start_tensorboard_process(args, nni_config, path_list, temp_nni_path):
exit
(
1
)
exit
(
1
)
with
open
(
os
.
path
.
join
(
temp_nni_path
,
'tensorboard_stdout'
),
'a+'
)
as
stdout_file
,
\
with
open
(
os
.
path
.
join
(
temp_nni_path
,
'tensorboard_stdout'
),
'a+'
)
as
stdout_file
,
\
open
(
os
.
path
.
join
(
temp_nni_path
,
'tensorboard_stderr'
),
'a+'
)
as
stderr_file
:
open
(
os
.
path
.
join
(
temp_nni_path
,
'tensorboard_stderr'
),
'a+'
)
as
stderr_file
:
cmds
=
[
'tensorboard'
,
'--logdir'
,
format_tensorboard_log_path
(
path_list
),
'--port'
,
str
(
args
.
port
)]
log_dir_cmd
=
'--logdir_spec'
if
check_tensorboard_version
()
>=
'2.0'
else
'--logdir'
cmds
=
[
'tensorboard'
,
log_dir_cmd
,
format_tensorboard_log_path
(
path_list
),
'--port'
,
str
(
args
.
port
)]
tensorboard_process
=
Popen
(
cmds
,
stdout
=
stdout_file
,
stderr
=
stderr_file
)
tensorboard_process
=
Popen
(
cmds
,
stdout
=
stdout_file
,
stderr
=
stderr_file
)
url_list
=
get_local_urls
(
args
.
port
)
url_list
=
get_local_urls
(
args
.
port
)
print_normal
(
COLOR_GREEN_FORMAT
%
'Start tensorboard success!
\n
'
+
'Tensorboard urls: '
+
' '
.
join
(
url_list
))
print_normal
(
COLOR_GREEN_FORMAT
%
'Start tensorboard success!
\n
'
+
'Tensorboard urls: '
+
' '
.
join
(
url_list
))
...
...
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