diff --git a/Jenkinsfile b/Jenkinsfile index e018a3d..2a6b022 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,8 +26,6 @@ pipeline{ steps{ withEnv(["CUTOFF=${params.CUTOFF}"]) { sh "chmod 777 ./script.sh" - - } }} stage('Archive artifacts'){ @@ -35,7 +33,12 @@ pipeline{ archiveArtifacts 'test.csv' archiveArtifacts 'dev.csv' archiveArtifacts 'train.csv' - + } } } -}} \ No newline at end of file + post { + success { + build job: 's430705-training/master', parameters: [string(name: 'epochs', defaultValue:'300'), string(name: 'BUILD_SELECTOR', defaultValue: lastSuccessful()] + } + } +} \ No newline at end of file diff --git a/Jenkinsfile_training b/Jenkinsfile_training index bcbadba..18e3892 100644 --- a/Jenkinsfile_training +++ b/Jenkinsfile_training @@ -5,15 +5,18 @@ pipeline { defaultSelector: lastSuccessful(), description: 'Which build to use for copying artifacts', name: 'BUILD_SELECTOR') + string( + defaultValue: '300', + description: 'Number of epochs.', + name: 'epochs', + trim: false } + stages { stage('copyArtifacts') { steps { copyArtifacts fingerprintArtifacts: true, projectName: 's430705-create-dataset', selector: buildParameter('BUILD_SELECTOR') - sh 'python3 lab06_training.py' - sh 'ls -l' - sh 'pwd' - + sh 'python3 lab06_training.py $epochs' } } @@ -22,12 +25,22 @@ pipeline { archiveArtifacts 'model_movies/**' } } - stage('Send notification'){ - steps{ - emailext body: currentBuild.result ?: 'SUCCESS +1 YEA', - subject: 's43705', + } + + post { + success { + emailtext body: 'SUCCESS', + subject: 's430705', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' - } + } + unstable { + emailtext body: 'UNSTABLE', subject: 's430705', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' + } + failure { + emailtext body: 'FAILURE', subject: 's430705', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' + } + changed { + emailtext body: 'CHANGED', subject: 's430705', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' } } } \ No newline at end of file diff --git a/lab06_training.py b/lab06_training.py index 5352e2f..bd1fed6 100644 --- a/lab06_training.py +++ b/lab06_training.py @@ -1,3 +1,4 @@ +import sys import string import pandas as pd from sklearn.model_selection import train_test_split @@ -36,6 +37,7 @@ model.compile(optimizer="adam", loss="mse") early_stop = EarlyStopping(monitor="val_loss", mode="min", verbose=1, patience=10) +epochs = int(sys.argv[1]) if len(sys.argv) > 1 else 300 model.fit( x=X_train.values,