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
964d9a92
Unverified
Commit
964d9a92
authored
May 27, 2021
by
Ni Hao
Committed by
GitHub
May 27, 2021
Browse files
fix url and api conflict (#3672)
Co-authored-by:
Hao Ni
<
v-nihao@microsoft.com
>
parent
727ee1ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
nni/tools/nnictl/launcher.py
nni/tools/nnictl/launcher.py
+3
-2
nni/tools/nnictl/url_utils.py
nni/tools/nnictl/url_utils.py
+2
-2
ts/nni_manager/common/experimentStartupInfo.ts
ts/nni_manager/common/experimentStartupInfo.ts
+1
-1
No files found.
nni/tools/nnictl/launcher.py
View file @
964d9a92
...
@@ -452,10 +452,11 @@ def launch_experiment(args, experiment_config, mode, experiment_id, config_versi
...
@@ -452,10 +452,11 @@ def launch_experiment(args, experiment_config, mode, experiment_id, config_versi
except
Exception
:
except
Exception
:
raise
Exception
(
ERROR_INFO
%
'Restful server stopped!'
)
raise
Exception
(
ERROR_INFO
%
'Restful server stopped!'
)
exit
(
1
)
exit
(
1
)
url_prefix_format
=
''
if
args
.
url_prefix
is
None
else
'/{0}'
.
format
(
args
.
url_prefix
)
if
experiment_config
.
get
(
'nniManagerIp'
):
if
experiment_config
.
get
(
'nniManagerIp'
):
web_ui_url_list
=
[
'http://{0}:{1}{2}'
.
format
(
experiment_config
[
'nniManagerIp'
],
str
(
args
.
port
),
formatURLPath
(
args
.
url_prefix
)
)]
web_ui_url_list
=
[
'http://{0}:{1}{2}'
.
format
(
experiment_config
[
'nniManagerIp'
],
str
(
args
.
port
),
url_prefix
_format
)]
else
:
else
:
web_ui_url_list
=
get_local_urls
(
args
.
port
,
args
.
url_prefix
)
web_ui_url_list
=
get_local_urls
(
args
.
port
,
url_prefix
_format
)
Experiments
().
update_experiment
(
experiment_id
,
'webuiUrl'
,
web_ui_url_list
)
Experiments
().
update_experiment
(
experiment_id
,
'webuiUrl'
,
web_ui_url_list
)
print_normal
(
EXPERIMENT_SUCCESS_INFO
%
(
experiment_id
,
' '
.
join
(
web_ui_url_list
)))
print_normal
(
EXPERIMENT_SUCCESS_INFO
%
(
experiment_id
,
' '
.
join
(
web_ui_url_list
)))
...
...
nni/tools/nnictl/url_utils.py
View file @
964d9a92
...
@@ -25,7 +25,7 @@ TENSORBOARD_API = '/tensorboard'
...
@@ -25,7 +25,7 @@ TENSORBOARD_API = '/tensorboard'
METRIC_DATA_API
=
'/metric-data'
METRIC_DATA_API
=
'/metric-data'
def
formatURLPath
(
path
):
def
formatURLPath
(
path
):
return
''
if
path
is
None
else
'/{0}'
.
format
(
path
)
return
API_ROOT_URL
if
path
is
None
else
'/{0}
{1}
'
.
format
(
path
,
API_ROOT_URL
)
def
setPrefixUrl
(
prefix_path
):
def
setPrefixUrl
(
prefix_path
):
global
API_ROOT_URL
global
API_ROOT_URL
...
@@ -81,5 +81,5 @@ def get_local_urls(port,prefix):
...
@@ -81,5 +81,5 @@ def get_local_urls(port,prefix):
for
_
,
info
in
psutil
.
net_if_addrs
().
items
():
for
_
,
info
in
psutil
.
net_if_addrs
().
items
():
for
addr
in
info
:
for
addr
in
info
:
if
socket
.
AddressFamily
.
AF_INET
==
addr
.
family
:
if
socket
.
AddressFamily
.
AF_INET
==
addr
.
family
:
url_list
.
append
(
'http://{0}:{1}{2}'
.
format
(
addr
.
address
,
port
,
formatURLPath
(
prefix
))
)
url_list
.
append
(
'http://{0}:{1}{2}'
.
format
(
addr
.
address
,
port
,
prefix
))
return
url_list
return
url_list
ts/nni_manager/common/experimentStartupInfo.ts
View file @
964d9a92
...
@@ -104,7 +104,7 @@ class ExperimentStartupInfo {
...
@@ -104,7 +104,7 @@ class ExperimentStartupInfo {
public
getAPIRootUrl
():
string
{
public
getAPIRootUrl
():
string
{
assert
(
this
.
initialized
);
assert
(
this
.
initialized
);
return
this
.
urlprefix
==
''
?
this
.
API_ROOT_URL
:
`/
${
this
.
urlprefix
}
`
;
return
this
.
urlprefix
==
''
?
this
.
API_ROOT_URL
:
`/
${
this
.
urlprefix
}
${
this
.
API_ROOT_URL
}
`
;
}
}
}
}
...
...
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