"...CHARM/git@developer.sourcefind.cn:OpenDAS/opencompass.git" did not exist on "608ff5810dd2fea1161acbd936cfb4d6bf4cfb28"
Commit 9210fd6b authored by Gems Guo's avatar Gems Guo Committed by goooxu
Browse files

Integrate version number of NNI

parent 9397b6f6
......@@ -3,22 +3,21 @@
PIP_INSTALL := python3 -m pip install
PIP_UNINSTALL := python3 -m pip uninstall
# detect OS
## Colorful output
_INFO := $(shell echo -e '\e[1;36m')
_WARNING := $(shell echo -e '\e[1;33m')
_END := $(shell echo -e '\e[0m')
## Detect OS
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Linux)
OS_SPEC := linux
## Colorful output
_INFO := $(shell echo -e '\e[1;36m')
_WARNING := $(shell echo -e '\e[1;33m')
_END := $(shell echo -e '\e[0m')
else ifeq ($(UNAME_S), Darwin)
OS_SPEC := darwin
else
$(error platform $(UNAME_S) not supported)
endif
## Install directories
ifeq ($(shell id -u), 0) # is root
_ROOT := 1
......@@ -34,7 +33,6 @@ endif
BASH_COMP_SCRIPT := $(BASH_COMP_PREFIX)/nnictl
NNI_INSTALL_PATH ?= $(INSTALL_PREFIX)/nni
NNI_TMP_PATH ?= /tmp
BIN_FOLDER ?= $(ROOT_FOLDER)/bin
NNI_PKG_FOLDER ?= $(ROOT_FOLDER)/nni
......@@ -47,6 +45,9 @@ NNI_YARN_TARBALL ?= /tmp/nni-yarn.tar.gz
NNI_YARN_FOLDER ?= /tmp/nni-yarn
NNI_YARN := PATH=$(BIN_FOLDER):$${PATH} $(NNI_YARN_FOLDER)/bin/yarn
## Version number
NNI_VERSION = $(shell git describe --tags)
# Main targets
.PHONY: build
......@@ -159,18 +160,18 @@ install-dependencies: $(NNI_NODE_TARBALL) $(NNI_YARN_TARBALL)
.PHONY: install-python-modules
install-python-modules:
#$(_INFO) Installing Python SDK $(_END)
cd src/sdk/pynni && $(PIP_INSTALL) $(PIP_MODE) .
cd src/sdk/pynni && sed -ie 's/NNI_VERSION/$(NNI_VERSION)/' setup.py && $(PIP_INSTALL) $(PIP_MODE) .
#$(_INFO) Installing nnictl $(_END)
cd tools && $(PIP_INSTALL) $(PIP_MODE) .
cd tools && sed -ie 's/NNI_VERSION/$(NNI_VERSION)/' setup.py && $(PIP_INSTALL) $(PIP_MODE) .
.PHONY: dev-install-python-modules
dev-install-python-modules:
#$(_INFO) Installing Python SDK $(_END)
cd src/sdk/pynni && $(PIP_INSTALL) $(PIP_MODE) -e .
cd src/sdk/pynni && sed -ie 's/NNI_VERSION/$(NNI_VERSION)/' setup.py && $(PIP_INSTALL) $(PIP_MODE) -e .
#$(_INFO) Installing nnictl $(_END)
cd tools && $(PIP_INSTALL) $(PIP_MODE) -e .
cd tools && sed -ie 's/NNI_VERSION/$(NNI_VERSION)/' setup.py && $(PIP_INSTALL) $(PIP_MODE) -e .
.PHONY: install-node-modules
install-node-modules:
......@@ -178,6 +179,7 @@ install-node-modules:
rm -rf $(NNI_PKG_FOLDER)
cp -r src/nni_manager/dist $(NNI_PKG_FOLDER)
cp src/nni_manager/package.json $(NNI_PKG_FOLDER)
sed -ie 's/NNI_VERSION/$(NNI_VERSION)/' $(NNI_PKG_FOLDER)/package.json
$(NNI_YARN) --prod --cwd $(NNI_PKG_FOLDER)
cp -r src/webui/build $(NNI_PKG_FOLDER)/static
......
......@@ -11,6 +11,8 @@ else
$(error platform $(UNAME_S) not supported)
endif
NNI_VERSION = $(shell git describe --tags)
.PHONY: build
build:
python3 -m pip install --user --upgrade setuptools wheel
......@@ -24,9 +26,10 @@ build:
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
sed -ie 's/NNI_VERSION/$(NNI_VERSION)/' $(CWD)nni/package.json
cd $(CWD)nni && yarn --prod
cd $(CWD) && python3 setup.py bdist_wheel -p $(WHEEL_SPEC)
cd $(CWD)../../src/sdk/pynni && python3 setup.py bdist_wheel
cd $(CWD) && sed -ie 's/NNI_VERSION/$(NNI_VERSION)/' setup.py && python3 setup.py bdist_wheel -p $(WHEEL_SPEC)
cd $(CWD)../../src/sdk/pynni && sed -ie 's/NNI_VERSION/$(NNI_VERSION)/' setup.py && python3 setup.py bdist_wheel
cp -r $(CWD)../../src/sdk/pynni/dist/*.whl $(CWD)dist
cd $(CWD)
......@@ -37,9 +40,9 @@ upload:
.PHONY: clean
clean:
-rm -rf $(CWD)../../src/sdk/pynni/dist/*.whl
-rm -rf $(CWD)build
-rm -rf $(CWD)dist
-rm -rf $(CWD)nni
-rm -rf $(CWD)nni.egg-info
-rm -rf $(CWD)node-$(OS_SPEC)-x64
\ No newline at end of file
rm -rf $(CWD)../../src/sdk/pynni/dist
rm -rf $(CWD)build
rm -rf $(CWD)dist
rm -rf $(CWD)nni
rm -rf $(CWD)nni.egg-info
rm -rf $(CWD)node-$(OS_SPEC)-x64
\ No newline at end of file
......@@ -20,7 +20,7 @@ with open('../../README.md', 'r') as fh:
setuptools.setup(
name = 'nni',
version = '0.4',
version = 'NNI_VERSION',
author = 'Microsoft NNI team',
author_email = 'nni@microsoft.com',
description = 'Neural Network Intelligence package',
......
......@@ -35,7 +35,7 @@ class CustomInstallCommand(install):
setup(
name = 'nni',
version = '0.4',
version = 'NNI_VERSION',
author = 'Microsoft NNI Team',
author_email = 'nni@microsoft.com',
description = 'Neural Network Intelligence project',
......
{
"name": "nni",
"version": "1.0.0",
"version": "NNI_VERSION",
"main": "index.js",
"scripts": {
"postbuild": "cp -rf scripts ./dist/ && cp -rf config ./dist/",
......
......@@ -61,6 +61,7 @@ class NNIRestHandler {
next();
});
this.version(router);
this.checkStatus(router);
this.getExperimentProfile(router);
this.updateExperimentProfile(router);
......@@ -108,6 +109,13 @@ class NNIRestHandler {
this.log.error(err);
}
private version(router: Router): void {
router.get('/version', async (req: Request, res: Response) => {
const pkg = await import(path.join(__dirname, '..', 'package.json'));
res.send(pkg.version);
});
}
// TODO add validators for request params, query, body
private checkStatus(router: Router): void {
router.get('/check-status', (req: Request, res: Response) => {
......
......@@ -27,7 +27,7 @@ def read(fname):
setuptools.setup(
name = 'nni-sdk',
version = '0.4',
version = 'NNI_VERSION',
packages = setuptools.find_packages(exclude=['tests']),
python_requires = '>=3.5',
......
......@@ -20,6 +20,7 @@
import argparse
import pkg_resources
from .launcher import create_experiment, resume_experiment
from .updater import update_searchspace, update_concurrency, update_duration, update_trialnum
from .nnictl_utils import *
......@@ -27,13 +28,17 @@ from .package_management import *
from .constants import *
from .tensorboard_utils import *
def nni_help_info(*args):
print('please run "nnictl {positional argument} --help" to see nnictl guidance')
def nni_info(*args):
if args[0].version:
print(pkg_resources.get_distribution('nnictl').version)
else:
print('please run "nnictl {positional argument} --help" to see nnictl guidance')
def parse_args():
'''Definite the arguments users need to follow and input'''
parser = argparse.ArgumentParser(prog='nnictl', description='use nnictl command to control nni experiments')
parser.set_defaults(func=nni_help_info)
parser.add_argument('--version', '-v', action='store_true')
parser.set_defaults(func=nni_info)
# create subparsers for args with sub values
subparsers = parser.add_subparsers()
......
......@@ -2,7 +2,7 @@ import setuptools
setuptools.setup(
name = 'nnictl',
version = '0.4',
version = 'NNI_VERSION',
packages = setuptools.find_packages(exclude=['*test*']),
python_requires = '>=3.5',
......
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