From bdc4ccdf9b6b983a6d8d8f2c031366b2f2a29b33 Mon Sep 17 00:00:00 2001 From: piotr6789 Date: Mon, 24 May 2021 11:56:06 +0200 Subject: [PATCH] add multipieline project --- lab06/Dockerfile | 6 +++++ lab06/jenkinsfile-train | 52 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 lab06/Dockerfile create mode 100644 lab06/jenkinsfile-train diff --git a/lab06/Dockerfile b/lab06/Dockerfile new file mode 100644 index 0000000..1e276be --- /dev/null +++ b/lab06/Dockerfile @@ -0,0 +1,6 @@ +FROM ubuntu:latest +RUN apt-get update && apt-get install -y python3-pip && pip3 install setuptools && pip3 install numpy && pip3 install pandas && pip3 install wget && pip3 install scikit-learn && pip3 install matplotlib && rm -rf /var/lib/apt/lists/* +RUN pip3 install torch torchvision torchaudio +RUN pip3 install sacred && pip3 install GitPython && pip3 install pymongo +WORKDIR /app +COPY ./../pytorch-example.py ./ \ No newline at end of file diff --git a/lab06/jenkinsfile-train b/lab06/jenkinsfile-train new file mode 100644 index 0000000..442e2d7 --- /dev/null +++ b/lab06/jenkinsfile-train @@ -0,0 +1,52 @@ +pipeline { + agent { + dockerfile true + } + parameters{ + buildSelector( + defaultSelector: lastSuccessful(), + description: 'Which build to use for copying artifacts', + name: 'WHICH_BUILD' + ) + string( + defaultValue: '16', + description: 'batch size', + name: 'BATCH_SIZE' + ) + string( + defaultValue: '15', + description: 'epochs', + name: 'EPOCHS' + + ) + } + stages { + stage('checkout') { + steps { + copyArtifacts fingerprintArtifacts: true, projectName: 's440058-create-dataset', selector: buildParameter('WHICH_BUILD') + } + } + stage('Docker'){ + steps{ + sh 'python3 "./pytorch-example.py" ${BATCH_SIZE} ${EPOCHS} > pred.txt' + } + } + stage('archiveArtifacts') { + steps{ + archiveArtifacts 'ium_s440058/**' + archiveArtifacts 'pred.txt' + archiveArtifacts 'diabetes.pkl' + } + } + } + post { + success { + mail body: 'SUCCESS TRAINING', subject: 's440058', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' + } + + failure { + mail body: 'FAILURE TRAINING', subject: 's440058', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' + } + + } +} \ No newline at end of file