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