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

update makefile #350

Merged
merged 3 commits into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ BIN_FOLDER ?= $(ROOT_FOLDER)/bin
NNI_PKG_FOLDER ?= $(ROOT_FOLDER)/nni

## Dependency information
$(info $(_INFO) Installing dependencies, use local toolchain $(_END))
NNI_NODE_TARBALL ?= /tmp/nni-node-linux-x64.tar.xz
NNI_NODE_FOLDER = /tmp/nni-node-linux-x64
NNI_NODE ?= $(BIN_FOLDER)/node
Expand Down Expand Up @@ -104,6 +103,17 @@ uninstall:
-rm -f $(BIN_FOLDER)/nnictl
-rm -f $(BASH_COMP_SCRIPT)

.PHONY: clean
clean:
-rm -rf tools/build
-rm -rf tools/nnictl.egg-info
-rm -rf src/nni_manager/dist
-rm -rf src/nni_manager/node_modules
-rm -rf src/sdk/pynni/build
-rm -rf src/sdk/pynni/nni_sdk.egg-info
-rm -rf src/webui/build
-rm -rf src/webui/node_modules

# Main targets end

# Helper targets
Expand All @@ -116,7 +126,7 @@ $(NNI_YARN_TARBALL):
#$(_INFO) Downloading Yarn $(_END)
wget https://aka.ms/yarn-download -O $(NNI_YARN_TARBALL)

.PHONY: intall-dependencies
.PHONY: install-dependencies
install-dependencies: $(NNI_NODE_TARBALL) $(NNI_YARN_TARBALL)
#$(_INFO) Extracting Node.js $(_END)
rm -rf $(NNI_NODE_FOLDER)
Expand Down
16 changes: 13 additions & 3 deletions tools/nni_cmd/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import time
import random
import string
yds05 marked this conversation as resolved.
Show resolved Hide resolved
import site
from pathlib import Path


Expand Down Expand Up @@ -73,8 +74,17 @@ def start_rest_server(port, platform, mode, config_file_name, experiment_id=None
exit(1)

print_normal('Starting restful server...')
base_dir = str(Path(os.path.dirname(__file__)).parents[3])
cmds = ['node', os.path.join(base_dir, 'nni', 'main.js'), '--port', str(port), '--mode', platform, '--start_mode', mode]
python_dir = str(Path(site.getusersitepackages()).parents[2])
entry_file = os.path.join(python_dir, 'nni', 'main.js')
entry_dir = os.path.join(python_dir, 'nni')
local_entry_dir = entry_dir
if not os.path.isfile(entry_file):
python_dir = str(Path(site.getsitepackages()[0]).parents[2])
entry_file = os.path.join(python_dir, 'nni', 'main.js')
entry_dir = os.path.join(python_dir, 'nni')
if not os.path.isfile(entry_file):
raise Exception('Fail to find main.js under both %s and %s!' % (local_entry_dir, entry_dir))
cmds = ['node', entry_file, '--port', str(port), '--mode', platform, '--start_mode', mode]
yds05 marked this conversation as resolved.
Show resolved Hide resolved
if mode == 'resume':
cmds += ['--experiment_id', experiment_id]
stdout_full_path, stderr_full_path = get_log_path(config_file_name)
Expand All @@ -85,7 +95,7 @@ def start_rest_server(port, platform, mode, config_file_name, experiment_id=None
log_header = LOG_HEADER % str(time_now)
stdout_file.write(log_header)
stderr_file.write(log_header)
process = Popen(cmds, cwd=os.path.join(base_dir, 'nni'), stdout=stdout_file, stderr=stderr_file)
process = Popen(cmds, cwd=entry_dir, stdout=stdout_file, stderr=stderr_file)
return process, str(time_now)

def set_trial_config(experiment_config, port, config_file_name):
Expand Down