Unverified Commit 80b6cb3b authored by liuzhe-lz's avatar liuzhe-lz Committed by GitHub
Browse files

Merge pull request #3030 from microsoft/v2.0

Merge v2.0 into master
parents 77dac12b ff1af7f2
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import ast import ast
import astor import astor
from nni_cmd.common_utils import print_warning from nni.tools.nnictl.common_utils import print_warning
from .utils import ast_Num, ast_Str from .utils import ast_Num, ast_Str
......
...@@ -6,7 +6,7 @@ import logging ...@@ -6,7 +6,7 @@ import logging
import os import os
import netifaces import netifaces
from schema import Schema, And, Optional, Regex, Or, SchemaError from schema import Schema, And, Optional, Regex, Or, SchemaError
from nni.package_utils import create_validator_instance, get_all_builtin_names, get_builtin_algo_meta from nni.tools.package_utils import create_validator_instance, get_all_builtin_names, get_builtin_algo_meta
from .constants import SCHEMA_TYPE_ERROR, SCHEMA_RANGE_ERROR, SCHEMA_PATH_ERROR from .constants import SCHEMA_TYPE_ERROR, SCHEMA_RANGE_ERROR, SCHEMA_PATH_ERROR
from .common_utils import get_yml_content, print_warning from .common_utils import get_yml_content, print_warning
......
...@@ -9,8 +9,9 @@ import random ...@@ -9,8 +9,9 @@ import random
import time import time
import tempfile import tempfile
from subprocess import Popen, check_call, CalledProcessError, PIPE, STDOUT from subprocess import Popen, check_call, CalledProcessError, PIPE, STDOUT
from nni_annotation import expand_annotations, generate_search_space from nni.tools.annotation import expand_annotations, generate_search_space
from nni.package_utils import get_builtin_module_class_name, get_nni_installation_path from nni.tools.package_utils import get_builtin_module_class_name
import nni_node
from .launcher_utils import validate_all_content from .launcher_utils import validate_all_content
from .rest_utils import rest_put, rest_post, check_rest_server, check_response 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 from .url_utils import cluster_metadata_url, experiment_url, get_local_urls
...@@ -52,15 +53,16 @@ def start_rest_server(port, platform, mode, config_file_name, foreground=False, ...@@ -52,15 +53,16 @@ def start_rest_server(port, platform, mode, config_file_name, foreground=False,
print_normal('Starting restful server...') print_normal('Starting restful server...')
entry_dir = get_nni_installation_path() entry_dir = nni_node.__path__[0]
if (not entry_dir) or (not os.path.exists(entry_dir)): if (not entry_dir) or (not os.path.exists(entry_dir)):
print_error('Fail to find nni under python library') print_error('Fail to find nni under python library')
exit(1) exit(1)
entry_file = os.path.join(entry_dir, 'main.js') entry_file = os.path.join(entry_dir, 'main.js')
node_command = 'node'
if sys.platform == 'win32': if sys.platform == 'win32':
node_command = os.path.join(entry_dir[:-3], 'Scripts', 'node.exe') node_command = os.path.join(entry_dir, 'node.exe')
else:
node_command = 'node'
cmds = [node_command, '--max-old-space-size=4096', entry_file, '--port', str(port), '--mode', platform] cmds = [node_command, '--max-old-space-size=4096', entry_file, '--port', str(port), '--mode', platform]
if mode == 'view': if mode == 'view':
cmds += ['--start_mode', 'resume'] cmds += ['--start_mode', 'resume']
......
...@@ -13,8 +13,8 @@ from functools import cmp_to_key ...@@ -13,8 +13,8 @@ from functools import cmp_to_key
from datetime import datetime, timezone from datetime import datetime, timezone
from subprocess import Popen from subprocess import Popen
from pyhdfs import HdfsClient from pyhdfs import HdfsClient
from nni.package_utils import get_nni_installation_path from nni.tools.annotation import expand_annotations
from nni_annotation import expand_annotations import nni_node
from .rest_utils import rest_get, rest_delete, check_rest_server_quick, check_response from .rest_utils import rest_get, rest_delete, check_rest_server_quick, check_response
from .url_utils import trial_jobs_url, experiment_url, trial_job_id_url, export_data_url, metric_data_url from .url_utils import trial_jobs_url, experiment_url, trial_job_id_url, export_data_url, metric_data_url
from .config_utils import Config, Experiments from .config_utils import Config, Experiments
...@@ -424,13 +424,14 @@ def webui_nas(args): ...@@ -424,13 +424,14 @@ def webui_nas(args):
'''launch nas ui''' '''launch nas ui'''
print_normal('Starting NAS UI...') print_normal('Starting NAS UI...')
try: try:
entry_dir = get_nni_installation_path() entry_dir = nni_node.__path__[0]
entry_file = os.path.join(entry_dir, 'nasui', 'server.js') entry_file = os.path.join(entry_dir, 'nasui', 'server.js')
node_command = 'node'
if sys.platform == 'win32': if sys.platform == 'win32':
node_command = os.path.join(entry_dir[:-3], 'Scripts', 'node.exe') node_command = os.path.join(entry_dir, 'node.exe')
else:
node_command = 'node'
cmds = [node_command, '--max-old-space-size=4096', entry_file, '--port', str(args.port), '--logdir', args.logdir] cmds = [node_command, '--max-old-space-size=4096', entry_file, '--port', str(args.port), '--logdir', args.logdir]
subprocess.run(cmds) subprocess.run(cmds, cwd=entry_dir)
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass
......
...@@ -6,7 +6,7 @@ from collections import defaultdict ...@@ -6,7 +6,7 @@ from collections import defaultdict
import json import json
import pkginfo import pkginfo
import nni import nni
from nni.package_utils import read_installed_package_meta, get_installed_package_meta, \ from nni.tools.package_utils import read_installed_package_meta, get_installed_package_meta, \
write_package_meta, get_builtin_algo_meta, get_not_installable_builtin_names, ALGO_TYPES write_package_meta, get_builtin_algo_meta, get_not_installable_builtin_names, ALGO_TYPES
from .constants import INSTALLABLE_PACKAGE_META from .constants import INSTALLABLE_PACKAGE_META
...@@ -19,7 +19,7 @@ def install_by_name(package_name): ...@@ -19,7 +19,7 @@ def install_by_name(package_name):
if package_name not in INSTALLABLE_PACKAGE_META: if package_name not in INSTALLABLE_PACKAGE_META:
raise RuntimeError('{} is not found in installable packages!'.format(package_name)) raise RuntimeError('{} is not found in installable packages!'.format(package_name))
requirements_path = os.path.join(nni.__path__[0], INSTALLABLE_PACKAGE_META[package_name]['code_sub_dir'], 'requirements.txt') requirements_path = os.path.join(nni.__path__[0], 'algorithms/hpo', INSTALLABLE_PACKAGE_META[package_name]['code_sub_dir'], 'requirements.txt')
assert os.path.exists(requirements_path) assert os.path.exists(requirements_path)
return install_requirements_command(requirements_path) return install_requirements_command(requirements_path)
......
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