Unverified Commit 964d9a92 authored by Ni Hao's avatar Ni Hao Committed by GitHub
Browse files

fix url and api conflict (#3672)


Co-authored-by: default avatarHao Ni <v-nihao@microsoft.com>
parent 727ee1ce
......@@ -452,10 +452,11 @@ def launch_experiment(args, experiment_config, mode, experiment_id, config_versi
except Exception:
raise Exception(ERROR_INFO % 'Restful server stopped!')
exit(1)
url_prefix_format = '' if args.url_prefix is None else '/{0}'.format(args.url_prefix)
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:
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)
print_normal(EXPERIMENT_SUCCESS_INFO % (experiment_id, ' '.join(web_ui_url_list)))
......
......@@ -25,7 +25,7 @@ TENSORBOARD_API = '/tensorboard'
METRIC_DATA_API = '/metric-data'
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):
global API_ROOT_URL
......@@ -81,5 +81,5 @@ def get_local_urls(port,prefix):
for _, info in psutil.net_if_addrs().items():
for addr in info:
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
......@@ -104,7 +104,7 @@ class ExperimentStartupInfo {
public getAPIRootUrl(): string {
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}`;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment