Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
nnictl prompt descriptions for web_ui_urls
Browse files Browse the repository at this point in the history
  • Loading branch information
Hao Ni committed May 14, 2021
1 parent f1bb066 commit 5a71ce9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions nni/tools/nnictl/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import nni_node # pylint: disable=import-error
from .launcher_utils import validate_all_content
from .rest_utils import rest_put, rest_post, check_rest_server, check_response
from .url_utils import cluster_metadata_url, experiment_url, get_local_urls, path_validation
from .url_utils import cluster_metadata_url, experiment_url, get_local_urls, path_validation, formatURLPath
from .config_utils import Config, Experiments
from .common_utils import get_yml_content, get_json_content, print_error, print_normal, print_warning, \
detect_port, get_user
Expand Down Expand Up @@ -435,7 +435,6 @@ def launch_experiment(args, experiment_config, mode, experiment_id, config_versi
# set debug configuration
if mode != 'view' and experiment_config.get('debug') is None:
experiment_config['debug'] = args.debug
print_normal(config_version)
if config_version == 1:
response = set_experiment_v1(experiment_config, mode, args.port, experiment_id, args.url_prefix)
else:
Expand All @@ -452,9 +451,9 @@ def launch_experiment(args, experiment_config, mode, experiment_id, config_versi
raise Exception(ERROR_INFO % 'Restful server stopped!')
exit(1)
if experiment_config.get('nniManagerIp'):
web_ui_url_list = ['http://{0}:{1}'.format(experiment_config['nniManagerIp'], str(args.port))]
web_ui_url_list = ['http://{0}:{1}{2}'.format(experiment_config['nniManagerIp'], str(args.port), formatURLPath(args.url_prefix))]
else:
web_ui_url_list = get_local_urls(args.port)
web_ui_url_list = get_local_urls(args.port, args.url_prefix)
Experiments().update_experiment(experiment_id, 'webuiUrl', web_ui_url_list)

print_normal(EXPERIMENT_SUCCESS_INFO % (experiment_id, ' '.join(web_ui_url_list)))
Expand Down
4 changes: 2 additions & 2 deletions nni/tools/nnictl/url_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ def tensorboard_url(port,prefix):
return '{0}:{1}{2}{3}{4}'.format(BASE_URL, port, API_ROOT_URL, formatURLPath(prefix), TENSORBOARD_API)


def get_local_urls(port):
def get_local_urls(port,prefix):
'''get urls of local machine'''
url_list = []
for _, info in psutil.net_if_addrs().items():
for addr in info:
if socket.AddressFamily.AF_INET == addr.family:
url_list.append('http://{}:{}'.format(addr.address, port))
url_list.append('http://{0}:{1}{2}'.format(addr.address, port, formatURLPath(prefix)))
return url_list

0 comments on commit 5a71ce9

Please sign in to comment.