Unverified Commit cedc8047 authored by fishyds's avatar fishyds Committed by GitHub
Browse files

[Docker file improvement] Move 'pip install nni' into the last layer (#510)

* Dockerfile improvement

* Fix UT broken for kubeflow training service
parent 5461fe77
...@@ -50,11 +50,6 @@ RUN DEBIAN_FRONTEND=noninteractive && \ ...@@ -50,11 +50,6 @@ RUN DEBIAN_FRONTEND=noninteractive && \
RUN python3 -m pip --no-cache-dir install \ RUN python3 -m pip --no-cache-dir install \
numpy==1.14.3 scipy==1.1.0 numpy==1.14.3 scipy==1.1.0
#
#Install NNI
#
RUN python3 -m pip install nni
# #
#Tensorflow 1.10.0 #Tensorflow 1.10.0
# #
...@@ -76,6 +71,11 @@ RUN python3 -m pip install torchvision==0.2.1 ...@@ -76,6 +71,11 @@ RUN python3 -m pip install torchvision==0.2.1
# #
RUN python3 -m pip --no-cache-dir install scikit-learn==0.20.0 RUN python3 -m pip --no-cache-dir install scikit-learn==0.20.0
#
#Install NNI
#
RUN python3 -m pip --no-cache-dir install nni
ENV PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/root/.local/bin:/usr/bin:/bin:/sbin ENV PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/root/.local/bin:/usr/bin:/bin:/sbin
WORKDIR /root WORKDIR /root
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"scripts": { "scripts": {
"postbuild": "cp -rf scripts ./dist/ && cp -rf config ./dist/", "postbuild": "cp -rf scripts ./dist/ && cp -rf config ./dist/",
"build": "tsc", "build": "tsc",
"test": "mocha -r ts-node/register -t 15000 --recursive **/*.test.ts --colors", "test": "mocha -r ts-node/register -t 15000 --recursive **/*.test.ts --exclude node_modules/**/**/*.test.ts --colors",
"start": "node dist/main.js" "start": "node dist/main.js"
}, },
"license": "MIT", "license": "MIT",
......
...@@ -39,10 +39,10 @@ describe('Unit Test for KubeflowTrainingService', () => { ...@@ -39,10 +39,10 @@ describe('Unit Test for KubeflowTrainingService', () => {
let testKubeflowTrialConfig : any; let testKubeflowTrialConfig : any;
try { try {
testKubeflowConfig = JSON.parse(fs.readFileSync('../../.vscode/kubeflowCluster.json', 'utf8')); testKubeflowConfig = JSON.parse(fs.readFileSync('../../.vscode/kubeflowCluster.json', 'utf8'));
testKubeflowTrialConfig = `{\"command\":\"python3 mnist-keras.py\",\"codeDir\":\"/home/desy/nni/examples/trials/mnist",\"gpuNum\":\"1\",\"cpuNum\":\"2\",\"memoryMB\":\"8196\",\"image\":\"msranni/nni:v0.3.3\"}`; testKubeflowTrialConfig = `{\"command\":\"python3 mnist.py\",\"codeDir\":\"/tmp/nni/examples/trials/mnist",\"gpuNum\":\"1\",\"cpuNum\":\"2\",\"memoryMB\":\"8196\",\"image\":\"msranni/nni:latest\"}`;
} catch (err) { } catch (err) {
console.log('Please configure rminfo.json to enable remote machine unit test.'); console.log('Please configure kubeflowCluster.json to enable kubeflow training service unit test.');
//skip = true; skip = true;
} }
let kubeflowTrainingService: KubeflowTrainingService; let kubeflowTrainingService: KubeflowTrainingService;
...@@ -73,17 +73,11 @@ describe('Unit Test for KubeflowTrainingService', () => { ...@@ -73,17 +73,11 @@ describe('Unit Test for KubeflowTrainingService', () => {
kubeflowTrainingService.cleanUp(); kubeflowTrainingService.cleanUp();
}); });
it('Simple Test', async () => { it('Set cluster metadata', async () => {
if (skip) { if (skip) {
return; return;
} }
kubeflowTrainingService.setClusterMetadata(TrialConfigMetadataKey.KUBEFLOW_CLUSTER_CONFIG, testKubeflowConfig), await kubeflowTrainingService.setClusterMetadata(TrialConfigMetadataKey.KUBEFLOW_CLUSTER_CONFIG, testKubeflowConfig),
kubeflowTrainingService.setClusterMetadata(TrialConfigMetadataKey.TRIAL_CONFIG, testKubeflowTrialConfig); await kubeflowTrainingService.setClusterMetadata(TrialConfigMetadataKey.TRIAL_CONFIG, testKubeflowTrialConfig);
try {
const trialDetail = await kubeflowTrainingService.submitTrialJob({jobType : 'TRIAL'});
} catch(error) {
console.log('Submit job failed:' + error);
chai.assert(error)
}
}); });
}); });
\ No newline at end of file
...@@ -41,7 +41,7 @@ describe('Unit Test for PAITrainingService', () => { ...@@ -41,7 +41,7 @@ describe('Unit Test for PAITrainingService', () => {
try { try {
testPaiClusterInfo = JSON.parse(fs.readFileSync('../../.vscode/paiCluster.json', 'utf8')); testPaiClusterInfo = JSON.parse(fs.readFileSync('../../.vscode/paiCluster.json', 'utf8'));
paiCluster = `{\"userName\":\"${testPaiClusterInfo.userName}\",\"passWord\":\"${testPaiClusterInfo.passWord}\",\"host\":\"${testPaiClusterInfo.host}\"}`; paiCluster = `{\"userName\":\"${testPaiClusterInfo.userName}\",\"passWord\":\"${testPaiClusterInfo.passWord}\",\"host\":\"${testPaiClusterInfo.host}\"}`;
paiTrialConfig = `{\"command\":\"echo hello && ls\",\"codeDir\":\"/home/desy/nni/examples/trials/mnist",\"gpuNum\":\"1\", paiTrialConfig = `{\"command\":\"echo hello && ls\",\"codeDir\":\"/tmp/nni/examples/trials/mnist",\"gpuNum\":\"1\",
\"cpuNum\":\"1\",\"memoryMB\":\"8196\",\"image\":\"openpai/pai.example.tensorflow\",\"dataDir\":\"\",\"outputDir\":\"\"}`; \"cpuNum\":\"1\",\"memoryMB\":\"8196\",\"image\":\"openpai/pai.example.tensorflow\",\"dataDir\":\"\",\"outputDir\":\"\"}`;
} catch (err) { } catch (err) {
console.log('Please configure rminfo.json to enable remote machine unit test.'); console.log('Please configure rminfo.json to enable remote machine unit test.');
......
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