Commit e3872ba1 authored by Gems Guo's avatar Gems Guo Committed by goooxu
Browse files

Uniform the names of python modules

parent 761638d8
......@@ -22,7 +22,7 @@ else # is normal user
endif
BIN_FOLDER ?= $(ROOT_FOLDER)/bin
NNI_PKG_FOLDER ?= $(ROOT_FOLDER)/nni_pkg
NNI_PKG_FOLDER ?= $(ROOT_FOLDER)/nni
## Dependency information
$(info $(_INFO) Installing dependencies, use local toolchain $(_END))
......
......@@ -32,7 +32,7 @@ The tool dispatches and runs trial jobs generated by tuning algorithms to search
* We only support Linux (Ubuntu 16.04 or higher) in our current stage.
* Run the following commands in an environment that has `python >= 3.5`, `git` and `wget`.
```bash
git clone -b v0.3.0 https://github.com/Microsoft/nni.git
git clone -b v0.3.2 https://github.com/Microsoft/nni.git
cd nni
source install.sh
```
......@@ -41,12 +41,11 @@ The tool dispatches and runs trial jobs generated by tuning algorithms to search
* The following example is an experiment built on TensorFlow. Make sure you have **TensorFlow installed** before running it.
* Download the examples via clone the source code.
```bash
cd ~
git clone -b v0.3.0 https://github.com/Microsoft/nni.git
git clone -b v0.3.2 https://github.com/Microsoft/nni.git
```
* Run the mnist example.
```bash
nnictl create --config ~/nni/examples/trials/mnist/config.yml
nnictl create --config nni/examples/trials/mnist/config.yml
```
* Wait for the message `INFO: Successfully started experiment!` in the command line. This message indicates that your experiment has been successfully started. You can explore the experiment using the `Web UI url`.
......
nni_pkg/
nni_annotation/
nnicmd/
nni/
dist/
build/
*.egg-info/
......
......@@ -9,15 +9,11 @@ build:
tar xf $(CWD)node-linux-x64.tar.xz -C node-linux-x64 --strip-components 1
cd $(CWD)../../src/nni_manager && yarn && yarn build
cd $(CWD)../../src/webui && yarn && yarn build
rm -rf $(CWD)nni_pkg
cp -r $(CWD)../../src/nni_manager/dist $(CWD)nni_pkg
cp -r $(CWD)../../src/webui/build $(CWD)nni_pkg/static
cp $(CWD)../../src/nni_manager/package.json $(CWD)nni_pkg
cd $(CWD)nni_pkg && yarn --prod
rm -rf $(CWD)nnicmd
rm -rf $(CWD)nni_annotation
cp -r $(CWD)../../tools/nnicmd $(CWD)nnicmd
cp -r $(CWD)../../tools/nni_annotation $(CWD)nni_annotation
rm -rf $(CWD)nni
cp -r $(CWD)../../src/nni_manager/dist $(CWD)nni
cp -r $(CWD)../../src/webui/build $(CWD)nni/static
cp $(CWD)../../src/nni_manager/package.json $(CWD)nni
cd $(CWD)nni && yarn --prod
cd $(CWD) && python3 setup.py bdist_wheel
cd $(CWD)../../src/sdk/pynni && python3 setup.py bdist_wheel
cp -r $(CWD)../../src/sdk/pynni/dist/*.whl $(CWD)dist
......
......@@ -2,7 +2,7 @@ import setuptools
from os import walk, path
data_files = [('bin', ['node-linux-x64/bin/node'])]
for (dirpath, dirnames, filenames) in walk('./nni_pkg'):
for (dirpath, dirnames, filenames) in walk('./nni'):
files = [path.normpath(path.join(dirpath, filename)) for filename in filenames]
data_files.append((path.normpath(dirpath), files))
......@@ -11,7 +11,7 @@ with open('../../README.md', 'r') as fh:
setuptools.setup(
name = 'nni',
version = '0.3.0',
version = '0.3.2',
author = 'Microsoft NNI team',
author_email = 'nni@microsoft.com',
description = 'Neural Network Intelligence package',
......@@ -19,7 +19,12 @@ setuptools.setup(
long_description_content_type = 'text/markdown',
license = 'MIT',
url = 'https://github.com/Microsoft/nni',
packages = setuptools.find_packages(),
packages = setuptools.find_packages('../../tools'),
package_dir = {
'nni_annotation': '../../tools/nni_annotation',
'nni_cmd': '../../tools/nni_cmd',
'nni_trial_tool':'../../tools/nni_trial_tool'
},
python_requires = '>=3.5',
install_requires = [
'nni-sdk',
......@@ -37,7 +42,7 @@ setuptools.setup(
data_files = data_files,
entry_points = {
'console_scripts' : [
'nnictl = nnicmd.nnictl:parse_args'
'nnictl = nni_cmd.nnictl:parse_args'
]
}
)
\ No newline at end of file
......@@ -14,11 +14,11 @@
* __Install NNI through pip__
python3 -m pip install --user nni
python3 -m pip install --user --upgrade nni
* __Install NNI through source code__
git clone -b v0.3.0 https://github.com/Microsoft/nni.git
git clone -b v0.3.2 https://github.com/Microsoft/nni.git
cd nni
source install.sh
......
......@@ -12,11 +12,11 @@
* __Install NNI through pip__
python3 -m pip install --user nni
python3 -m pip install --user --upgrade nni
* __Install NNI through source code__
git clone -b v0.3.0 https://github.com/Microsoft/nni.git
git clone -b v0.3.2 https://github.com/Microsoft/nni.git
cd nni
source install.sh
......
......@@ -15,7 +15,7 @@ For remote machines that are used only to run trials but not the nnictl, you can
* __Install python SDK through pip__
python3 -m pip install --user nni-sdk
python3 -m pip install --user --upgrade nni-sdk
* __Install python SDK through source code__
......
......@@ -15,7 +15,7 @@ For remote machines that are used only to run trials but not the nnictl, you can
* __Install python SDK through pip__
python3 -m pip install --user nni-sdk
python3 -m pip install --user --upgrade nni-sdk
* __Install python SDK through source code__
......
......@@ -35,7 +35,7 @@ class CustomInstallCommand(install):
setup(
name = 'nni',
version = '0.3.0',
version = '0.3.2',
author = 'Microsoft NNI Team',
author_email = 'nni@microsoft.com',
description = 'Neural Network Intelligence project',
......@@ -45,10 +45,10 @@ setup(
packages = find_packages('src/sdk/pynni', exclude=['tests']) + find_packages('tools'),
package_dir = {
'nni_annotation': 'tools/nni_annotation',
'nni': 'src/sdk/pynni/nni',
'nnicmd': 'tools/nnicmd',
'trial_tool':'tools/trial_tool'
'nni_annotation': 'tools/nni_annotation',
'nni_cmd': 'tools/nni_cmd',
'nni_trial_tool':'tools/nni_trial_tool'
},
package_data = {'nni': ['**/requirements.txt']},
python_requires = '>=3.5',
......
......@@ -70,23 +70,23 @@ class Logger {
private DEFAULT_LOGFILE: string = path.join(getLogDir(), 'nnimanager.log');
private level: number = DEBUG;
private bufferSerialEmitter: BufferSerialEmitter;
private writble: Writable;
private writable: Writable;
constructor(fileName?: string) {
let logFile: string | undefined = fileName;
if (logFile === undefined) {
logFile = this.DEFAULT_LOGFILE;
}
this.writble = fs.createWriteStream(logFile, {
this.writable = fs.createWriteStream(logFile, {
flags: 'a+',
encoding: 'utf8',
autoClose: true
});
this.bufferSerialEmitter = new BufferSerialEmitter(this.writble);
this.bufferSerialEmitter = new BufferSerialEmitter(this.writable);
}
public close() {
this.writble.destroy();
this.writable.destroy();
}
public debug(...param: any[]): void {
......
......@@ -341,7 +341,7 @@ class NNIManager implements Manager {
private async periodicallyUpdateExecDuration(): Promise<void> {
let count: number = 1;
while (this.status.status !== 'STOPPING') {
while (this.status.status !== 'STOPPING' && this.status.status !== 'STOPPED') {
await delay(1000 * 1); // 1 seconds
if (this.status.status === 'EXPERIMENT_RUNNING') {
this.experimentProfile.execDuration += 1;
......@@ -354,7 +354,6 @@ class NNIManager implements Manager {
}
private async requestTrialJobsStatus(): Promise<number> {
const deferred: Deferred<number> = new Deferred<number>();
let finishedTrialJobNum: number = 0;
for (const trialJobId of Array.from(this.trialJobs.keys())) {
const trialJobDetail: TrialJobDetail = await this.trainingService.getTrialJob(trialJobId);
......@@ -385,9 +384,8 @@ class NNIManager implements Manager {
// TO DO: add warning in log
}
}
deferred.resolve(finishedTrialJobNum);
return deferred.promise;
return finishedTrialJobNum;
}
private async manageTrials(): Promise<void> {
......@@ -395,7 +393,7 @@ class NNIManager implements Manager {
throw new Error('Error: tuner has not been setup');
}
let allFinishedTrialJobNum: number = 0;
while (this.status.status !== 'STOPPING') {
while (this.status.status !== 'STOPPING' && this.status.status !== 'STOPPED') {
const finishedTrialJobNum: number = await this.requestTrialJobsStatus();
allFinishedTrialJobNum += finishedTrialJobNum;
......
......@@ -62,7 +62,7 @@ fi`;
export const PAI_TRIAL_COMMAND_FORMAT: string =
`export NNI_PLATFORM=pai NNI_SYS_DIR={0} NNI_OUTPUT_DIR={1} NNI_TRIAL_JOB_ID={2} NNI_EXP_ID={3}
&& cd $NNI_SYS_DIR && sh install_nni.sh
&& python3 -m trial_tool.trial_keeper --trial_command '{4}' --nnimanager_ip '{5}' --pai_hdfs_output_dir '{6}'
&& python3 -m nni_trial_tool.trial_keeper --trial_command '{4}' --nnimanager_ip '{5}' --pai_hdfs_output_dir '{6}'
--pai_hdfs_host '{7}' --pai_user_name {8}`;
export const PAI_OUTPUT_DIR_FORMAT: string =
......
#!/bin/sh
python3 -m nnicmd.nnictl $@
python3 -m nni_cmd.nnictl $@
......@@ -72,7 +72,7 @@ def start_rest_server(port, platform, mode, config_file_name, experiment_id=None
else:
site_dir = site.getusersitepackages()
python_dir = str(Path(site_dir).parents[2])
cmds = ['node', os.path.join(python_dir, 'nni_pkg', 'main.js'), '--port', str(port), '--mode', platform, '--start_mode', mode]
cmds = ['node', os.path.join(python_dir, 'nni', 'main.js'), '--port', str(port), '--mode', platform, '--start_mode', mode]
if mode == 'resume':
cmds += ['--experiment_id', experiment_id]
stdout_full_path, stderr_full_path = get_log_path(config_file_name)
......@@ -83,7 +83,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(python_dir, 'nni_pkg'), stdout=stdout_file, stderr=stderr_file)
process = Popen(cmds, cwd=os.path.join(python_dir, 'nni'), stdout=stdout_file, stderr=stderr_file)
return process, str(time_now)
def set_trial_config(experiment_config, port, config_file_name):
......@@ -250,7 +250,7 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
print_error('Restful server start failed!')
print_log_content(config_file_name)
try:
cmds = ['pkill', '-P', str(rest_process.pid)]
cmds = ['kill', str(rest_process.pid)]
call(cmds)
except Exception:
raise Exception(ERROR_INFO % 'Rest server stopped!')
......@@ -265,7 +265,7 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
else:
print_error('Failed! Error is: {}'.format(err_msg))
try:
cmds = ['pkill', '-P', str(rest_process.pid)]
cmds = ['kill', str(rest_process.pid)]
call(cmds)
except Exception:
raise Exception(ERROR_INFO % 'Rest server stopped!')
......@@ -279,7 +279,7 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
else:
print_error('Set local config failed!')
try:
cmds = ['pkill', '-P', str(rest_process.pid)]
cmds = ['kill', str(rest_process.pid)]
call(cmds)
except Exception:
raise Exception(ERROR_INFO % 'Rest server stopped!')
......@@ -295,7 +295,7 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
if err_msg:
print_error('Failed! Error is: {}'.format(err_msg))
try:
cmds = ['pkill', '-P', str(rest_process.pid)]
cmds = ['kill', str(rest_process.pid)]
call(cmds)
except Exception:
raise Exception(ERROR_INFO % 'Restful server stopped!')
......@@ -312,7 +312,7 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
print_error('Start experiment failed!')
print_log_content(config_file_name)
try:
cmds = ['pkill', '-P', str(rest_process.pid)]
cmds = ['kill', str(rest_process.pid)]
call(cmds)
except Exception:
raise Exception(ERROR_INFO % 'Restful server stopped!')
......
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