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

Commit

Permalink
Merge pull request #27 from Microsoft/master
Browse files Browse the repository at this point in the history
merge master
  • Loading branch information
SparkSnail authored Oct 11, 2018
2 parents 346badd + 04e79ad commit 4af27d6
Show file tree
Hide file tree
Showing 31 changed files with 191 additions and 370 deletions.
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ language: python
python:
- "3.6"
before_install:
- wget https://nodejs.org/dist/v10.10.0/node-v10.10.0-linux-x64.tar.xz
- tar xf node-v10.10.0-linux-x64.tar.xz
- sudo mv node-v10.10.0-linux-x64 /usr/local/node
- wget https://nodejs.org/dist/v10.12.0/node-v10.12.0-linux-x64.tar.xz
- tar xf node-v10.12.0-linux-x64.tar.xz
- sudo mv node-v10.12.0-linux-x64 /usr/local/node
- export PATH=/usr/local/node/bin:$PATH
- sudo sh -c 'PATH=/usr/local/node/bin:$PATH yarn global add serve'
install:
- make
- make easy-install
Expand Down
46 changes: 9 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,14 @@ else # is normal user
endif

## Dependency information
NODE_VERSION ?= v10.10.0
NODE_VERSION ?= v10.12.0
NODE_TARBALL ?= node-$(NODE_VERSION)-linux-x64.tar.xz
NODE_PATH ?= $(INSTALL_PREFIX)/nni/node

YARN_VERSION ?= v1.9.4
YARN_VERSION ?= v1.10.1
YARN_TARBALL ?= yarn-$(YARN_VERSION).tar.gz
YARN_PATH ?= /tmp/nni-yarn

SERVE_VERSION ?= 10.0.1
SERVE_TARBALL ?= serve-$(SERVE_VERSION).tgz
SERVE_PATH ?= $(INSTALL_PREFIX)/nni/serve


## Check if dependencies have been installed globally
ifeq (, $(shell command -v node 2>/dev/null))
$(info $(_INFO) Node.js not found $(_END))
Expand All @@ -57,21 +52,15 @@ ifeq (, $(shell command -v yarnpkg 2>/dev/null))
$(info $(_INFO) Yarn not found $(_END))
_MISS_DEPS := 1 # yarn not found
endif
ifeq (, $(shell command -v serve 2>/dev/null))
$(info $(_INFO) Serve not found $(_END))
_MISS_DEPS := 1 # serve not found
endif

ifdef _MISS_DEPS
$(info $(_INFO) Missing dependencies, use local toolchain $(_END))
NODE := $(NODE_PATH)/bin/node
YARN := PATH=$${PATH}:$(NODE_PATH)/bin $(YARN_PATH)/bin/yarn
SERVE := $(SERVE_PATH)/serve
else
$(info $(_INFO) All dependencies found, use global toolchain $(_END))
NODE := node
YARN := yarnpkg
SERVE := serve
endif


Expand All @@ -85,7 +74,7 @@ build:
#$(_INFO) Building NNI Manager $(_END)
cd src/nni_manager && $(YARN) && $(YARN) build

#$(_INFO) Building Web UI $(_END)
#$(_INFO) Building WebUI $(_END)
cd src/webui && $(YARN) && $(YARN) build

#$(_INFO) Building Python SDK $(_END)
Expand Down Expand Up @@ -169,19 +158,13 @@ $(YARN_TARBALL):
#$(_INFO) Downloading Yarn $(_END)
wget https://github.com/yarnpkg/yarn/releases/download/$(YARN_VERSION)/$(YARN_TARBALL)

$(SERVE_TARBALL):
#$(_INFO) Downloading serve $(_END)
wget https://registry.npmjs.org/serve/-/$(SERVE_TARBALL)

.PHONY: intall-dependencies
install-dependencies: $(NODE_TARBALL) $(YARN_TARBALL) $(SERVE_TARBALL)
install-dependencies: $(NODE_TARBALL) $(YARN_TARBALL)
#$(_INFO) Cleaning $(_END)
rm -rf $(NODE_PATH)
rm -rf $(YARN_PATH)
rm -rf $(SERVE_PATH)
mkdir -p $(NODE_PATH)
mkdir -p $(YARN_PATH)
mkdir -p $(SERVE_PATH)

#$(_INFO) Extracting Node.js $(_END)
tar -xf $(NODE_TARBALL)
Expand All @@ -190,15 +173,6 @@ install-dependencies: $(NODE_TARBALL) $(YARN_TARBALL) $(SERVE_TARBALL)
#$(_INFO) Extracting Yarn $(_END)
tar -xf $(YARN_TARBALL)
mv -fT yarn-$(YARN_VERSION) $(YARN_PATH)

#$(_INFO) Installing serve $(_END)
PATH=$${PATH}:$(NODE_PATH)/bin npm install --prefix $(SERVE_PATH) $(SERVE_TARBALL)

#$(_INFO) Creating serve executable script $(_END)
echo '#!/bin/sh' > $(SERVE_PATH)/serve
echo '$(NODE) $(SERVE_PATH)/node_modules/serve/bin/serve.js $$@' >> $(SERVE_PATH)/serve
chmod +x $(SERVE_PATH)/serve


.PHONY: install-python-modules
install-python-modules:
Expand All @@ -217,8 +191,8 @@ install-node-modules:
cp -rT src/nni_manager/dist $(INSTALL_PREFIX)/nni/nni_manager
cp -rT src/nni_manager/node_modules $(INSTALL_PREFIX)/nni/nni_manager/node_modules

#$(_INFO) Installing Web UI $(_END)
cp -rT src/webui/build $(INSTALL_PREFIX)/nni/webui
#$(_INFO) Installing WebUI $(_END)
cp -rT src/webui/build $(INSTALL_PREFIX)/nni/nni_manager/static


.PHONY: install-dev-modules
Expand All @@ -235,8 +209,8 @@ install-dev-modules:
ln -sf ${PWD}/src/nni_manager/dist $(INSTALL_PREFIX)/nni/nni_manager
ln -sf ${PWD}/src/nni_manager/node_modules $(INSTALL_PREFIX)/nni/nni_manager/node_modules

#$(_INFO) Installing Web UI $(_END)
ln -sf ${PWD}/src/webui/build $(INSTALL_PREFIX)/nni/webui
#$(_INFO) Installing WebUI $(_END)
ln -sf ${PWD}/src/webui/build $(INSTALL_PREFIX)/nni/nni_manager/static


.PHONY: install-scripts
Expand All @@ -250,8 +224,6 @@ install-scripts:

echo '#!/bin/sh' > $(BIN_PATH)/nnictl
echo 'NNI_MANAGER=$(BIN_PATH)/nnimanager \' >> $(BIN_PATH)/nnictl
echo 'NNI_SERVE=$(SERVE) \' >> $(BIN_PATH)/nnictl
echo 'WEB_UI_FOLDER=$(INSTALL_PREFIX)/nni/webui \' >> $(BIN_PATH)/nnictl
echo 'python3 -m nnicmd.nnictl $$@' >> $(BIN_PATH)/nnictl
chmod +x $(BIN_PATH)/nnictl

Expand Down Expand Up @@ -300,7 +272,7 @@ ifdef _ROOT
$(error You should not develop NNI as root)
endif
ifdef _MISS_DEPS
# $(error Please install Node.js, Yarn, and Serve to develop NNI)
# $(error Please install Node.js and Yarn to develop NNI)
endif
#$(_INFO) Pass! $(_END)

Expand Down
12 changes: 5 additions & 7 deletions README.Makefile.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ The targets will be detailed later.

NNI requires at least Node.js, Yarn, and PIP to build, while TypeScript is also recommended.

NNI requires Node.js, serve, and all dependency libraries to run.
NNI requires Node.js, and all dependency libraries to run.
Required Node.js libraries (including TypeScript) can be installed by Yarn, and required Python libraries can be installed by setuptools or PIP.

For NNI *users*, `make install-dependencies` can be used to install Node.js, Yarn, and serve.
This will install Node.js and serve to NNI's installation directory, and install Yarn to `/tmp/nni-yarn`.
For NNI *users*, `make install-dependencies` can be used to install Node.js and Yarn.
This will install Node.js to NNI's installation directory, and install Yarn to `/tmp/nni-yarn`.
This target requires wget to work.

For NNI *developers*, it is recommended to install Node.js, Yarn, and serve manually.
For NNI *developers*, it is recommended to install Node.js and Yarn manually.
See their official sites for installation guide.

## Building NNI
Expand All @@ -42,7 +42,7 @@ When install as non-priviledged user and virtualenv is not detected, `--user` fl

In addition, `nnictl` offers a bash completion scripts, which will be installed to `/usr/share/bash-completion/completions` or `~/.bash_completion.d`.

In some configuration, NNI will also install Node.js and the serve module to `/usr/share/nni`.
In some configuration, NNI will also install Node.js to `/usr/share/nni`.

All directories mentioned above are configurable. See next section for details.

Expand All @@ -60,10 +60,8 @@ Available variables are listed below:
| `BASH_COMP_SCRIPT` | Path of bash completion script | `~/.bash_completion.d/nnictl` | `/usr/share/bash-completion/completions/nnictl` |
| `PIP_MODE` | Arguments for `python3 setup.py install` | `--user` if `VIRTUAL_ENV` not set | (empty) |
| `NODE_PATH` | Path to install Node.js runtime | `$INSTALL_PREFIX/nni/node` | `$INSTALL_PREFIX/nni/node` |
| `SERVE_PATH` | Path to install serve package | `$INSTALL_PREFIX/nni/serve` | `$INSTALL_PREFIX/nni/serve` |
| `YARN_PATH` | Path to install Yarn | `/tmp/nni-yarn` | `/tmp/nni-yarn` |
| `NODE` | Node.js command | see source file | see source file |
| `SERVE` | serve command | see source file | see source file |
| `YARN` | Yarn command | see source file | see source file |

Note that these variables will influence installation destination as well as generated `nnictl` and `nnimanager` scripts.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ Try it out:
nnictl create --config ~/nni/examples/trials/mnist/config.yml
```

In the command output, find out the **Web UI url** and open it in your browser. You can analyze your experiment through WebUI, or browse trials' tensorboard.
In the command output, find out the **WebUI url** and open it in your browser. You can analyze your experiment through WebUI, or browse trials' tensorboard.

To learn more about how this example was constructed and how to analyze the experiment results in NNI Web UI, please refer to [How to write a trial run on NNI (MNIST as an example)?](docs/WriteYourTrial.md)
To learn more about how this example was constructed and how to analyze the experiment results in NNI WebUI, please refer to [How to write a trial run on NNI (MNIST as an example)?](docs/WriteYourTrial.md)

## **Please refer to [Get Started Tutorial](docs/GetStarted.md) for more detailed information.**
## More tutorials
Expand Down
6 changes: 3 additions & 3 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Firstly, if you are unsure or afraid of anything, just ask or submit the issue o

However, for those individuals who want a bit more guidance on the best way to contribute to the project, read on. This document will cover all the points we're looking for in your contributions, raising your chances of quickly merging or addressing your contributions.

Looking for a quickstart, get acquainted with our [Get Started](./docs/GetStarted.md) guide.
Looking for a quickstart, get acquainted with our [Get Started](./GetStarted.md) guide.

There are a few simple guidelines that you need to follow before providing your hacks.

Expand All @@ -28,9 +28,9 @@ When raising issues, please specify the following:

Provide PRs with appropriate tags for bug fixes or enhancements to the source code. Do follow the correct naming conventions and code styles when you work on and do try to implement all code reviews along the way.

If you are looking for How to go about contributing and debugging the NNI source code, you can refer our [How to Contribute](./docs/HowToContribute.md) file in the `docs` folder.
If you are looking for How to go about contributing and debugging the NNI source code, you can refer our [How to Contribute](./HowToContribute.md) file in the `docs` folder.

Similarly for [writing trials](./docs/WriteYourTrial.md) or [starting experiments](StartExperiment.md). For everything else, refer [here](https://github.com/Microsoft/nni/tree/master/docs).
Similarly for [writing trials](./WriteYourTrial.md) or [starting experiments](StartExperiment.md). For everything else, refer [here](https://github.com/Microsoft/nni/tree/master/docs).

## Solve Existing Issues
Head over to [issues](https://github.com/Microsoft/nni/issues) to find issues where help is needed from contributors. You can find issues tagged with 'good-first-issue' or 'help-wanted' to contribute in.
Expand Down
4 changes: 2 additions & 2 deletions docs/ExperimentConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ machineList:
* __maxTrialNum__
* Description

__maxTrialNum__ specifies the max number of trial jobs created by nni, including successed and failed jobs.
__maxTrialNum__ specifies the max number of trial jobs created by nni, including succeeded and failed jobs.
* __trainingServicePlatform__
* Description
Expand Down Expand Up @@ -391,4 +391,4 @@ machineList:
username: test
sshKeyPath: /nni/sshkey
passphrase: qwert
```
```
2 changes: 1 addition & 1 deletion docs/HowToContribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ For example, run the command
```
nnictl create --config ~/nni/examples/trials/mnist/config.yml
```
And open web ui to check if everything is OK
And open WebUI to check if everything is OK

**6. Redeploy**

Expand Down
43 changes: 1 addition & 42 deletions docs/NNICTLDOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ nnictl stop
nnictl update
nnictl resume
nnictl trial
nnictl webui
nnictl experiment
nnictl config
nnictl log
Expand All @@ -33,9 +32,7 @@ nnictl log

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| --config, -c| True| |yaml configure file of the experiment|
| --webuiport, -w| False| 8080|assign a port for webui|

| --config, -c| True| |yaml configure file of the experiment|

* __nnictl resume__
Expand Down Expand Up @@ -140,44 +137,6 @@ nnictl log

### Manage WebUI
* __nnictl webui start__
* Description

Start web ui function for nni, and will get a url list, you can open any of the url to see nni web page.

* Usage

nnictl webui start [OPTIONS]

Options:

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| --port, -p| False| 8080|assign a port for webui|


* __nnictl webui stop__
* Description

Stop web ui function, and release url occupied. If you want to start again, use 'nnictl start webui' command
* Usage
nnictl webui stop
* __nnictl webui url__
* Description

Show the urls of web ui.
* Usage
nnictl webui url



### Manage experiment information

* __nnictl experiment show__
Expand Down
2 changes: 1 addition & 1 deletion docs/PAIMode.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ You can see the pai jobs created by NNI in your OpenPAI cluster's web portal, li

Notice: In pai mode, NNIManager will start a rest server and listen on `51189` port, to receive metrics from trial job running in PAI container. So you should `enable 51189` TCP port in your firewall rule to allow incoming traffic.

Once a trial job is completed, you can goto NNI WebUI's overview page (like http://localhost:8080/oview) to check trial's information.
Once a trial job is completed, you can goto NNI WebUI's overview page (like http://localhost:51188/oview) to check trial's information.

Expand a trial information in trial list view, click the logPath link like:
![](./nni_webui_joblist.jpg)
Expand Down
2 changes: 1 addition & 1 deletion docs/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Initial release of Neural Network Intelligence (NNI).
* Provide Python API for user to wrap trial code as NNI deployable codes
* Experiments
* Provide a command line toolkit 'nnictl' for experiments management
* Provide a web UI for viewing experiments details and managing experiments
* Provide a WebUI for viewing experiments details and managing experiments
* Continuous Integration
* Support CI by providing out-of-box integration with [travis-ci](https://github.com/travis-ci) on ubuntu
* Others
Expand Down
8 changes: 4 additions & 4 deletions docs/StartExperiment.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ NNICTL need to set experiment config before start an experiment, experiment conf
### 2.5 Check experiment cofig
NNICTL will ensure the request to set config is successfully executed.

### 2.6 Start Web UI
NNICTL will start a Web UI process to show Web UI information,the default port of Web UI is 8080.
### 2.6 Start WebUI
NNICTL will start a WebUI to show information,the default port of WebUI is 51188.

### 2.7 Check Web UI
If Web UI is not successfully started, nnictl will give a warning information, and will continue to start experiment.
### 2.7 Check WebUI
If WebUI is not successfully started, nnictl will give a warning information, and will continue to start experiment.

### 2.8 Start Experiment
This is the most import step of starting an nni experiment, nnictl will call restful server process to setup an experiment.
Expand Down
2 changes: 1 addition & 1 deletion src/nni_manager/common/datastore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ abstract class DataStore {
public abstract listTrialJobs(status?: TrialJobStatus): Promise<TrialJobInfo[]>;
public abstract getTrialJob(trialJobId: string): Promise<TrialJobInfo>;
public abstract storeMetricData(trialJobId: string, data: string): Promise<void>;
public abstract getMetricData(trialJobId: string, metricType: MetricType): Promise<MetricDataRecord[]>;
public abstract getMetricData(trialJobId?: string, metricType?: MetricType): Promise<MetricDataRecord[]>;
}

abstract class Database {
Expand Down
2 changes: 1 addition & 1 deletion src/nni_manager/common/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ abstract class Manager {
public abstract setClusterMetadata(key: string, value: string): Promise<void>;
public abstract getClusterMetadata(key: string): Promise<string>;

public abstract getMetricData(trialJobId: string, metricType: MetricType): Promise<MetricDataRecord[]>;
public abstract getMetricData(trialJobId?: string, metricType?: MetricType): Promise<MetricDataRecord[]>;
public abstract getTrialJobStatistics(): Promise<TrialJobStatistics[]>;
public abstract getStatus(): NNIManagerStatus;
}
Expand Down
2 changes: 1 addition & 1 deletion src/nni_manager/core/nniDataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class NNIDataStore implements DataStore {
}));
}

public getMetricData(trialJobId: string, metricType: MetricType): Promise<MetricDataRecord[]> {
public getMetricData(trialJobId?: string, metricType?: MetricType): Promise<MetricDataRecord[]> {
return this.db.queryMetricData(trialJobId, metricType);
}

Expand Down
2 changes: 1 addition & 1 deletion src/nni_manager/core/nnimanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class NNIManager implements Manager {
}
}

public async getMetricData(trialJobId: string, metricType: MetricType): Promise<MetricDataRecord[]> {
public async getMetricData(trialJobId?: string, metricType?: MetricType): Promise<MetricDataRecord[]> {
return this.dataStore.getMetricData(trialJobId, metricType);
}

Expand Down
8 changes: 5 additions & 3 deletions src/nni_manager/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ function usage(): void {
console.info('usage: node main.js --port <port> --mode <local/remote/pai> --start_mode <new/resume> --experiment_id <id>');
}

let port: number = NNIRestServer.DEFAULT_PORT;
const strPort: string = parseArg(['--port', '-p']);
if (strPort && strPort.length > 0) {
port = parseInt(strPort, 10);
if (!strPort || strPort.length === 0) {
usage();
process.exit(1);
}

const port: number = parseInt(strPort, 10);

const mode: string = parseArg(['--mode', '-m']);
if (!['local', 'remote', 'pai'].includes(mode)) {
usage();
Expand Down
Loading

0 comments on commit 4af27d6

Please sign in to comment.