Better email notifications, trigger training job after create-dataset, add params to training

This commit is contained in:
s430705 2021-05-13 09:34:30 +02:00
parent bf47da6b32
commit 58852c4daa
3 changed files with 31 additions and 13 deletions

11
Jenkinsfile vendored
View File

@ -26,8 +26,6 @@ pipeline{
steps{ steps{
withEnv(["CUTOFF=${params.CUTOFF}"]) { withEnv(["CUTOFF=${params.CUTOFF}"]) {
sh "chmod 777 ./script.sh" sh "chmod 777 ./script.sh"
} }
}} }}
stage('Archive artifacts'){ stage('Archive artifacts'){
@ -35,7 +33,12 @@ pipeline{
archiveArtifacts 'test.csv' archiveArtifacts 'test.csv'
archiveArtifacts 'dev.csv' archiveArtifacts 'dev.csv'
archiveArtifacts 'train.csv' archiveArtifacts 'train.csv'
} }
} }
}} }
post {
success {
build job: 's430705-training/master', parameters: [string(name: 'epochs', defaultValue:'300'), string(name: 'BUILD_SELECTOR', defaultValue: lastSuccessful()]
}
}
}

View File

@ -5,15 +5,18 @@ pipeline {
defaultSelector: lastSuccessful(), defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts', description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR') name: 'BUILD_SELECTOR')
string(
defaultValue: '300',
description: 'Number of epochs.',
name: 'epochs',
trim: false
} }
stages { stages {
stage('copyArtifacts') { stage('copyArtifacts') {
steps { steps {
copyArtifacts fingerprintArtifacts: true, projectName: 's430705-create-dataset', selector: buildParameter('BUILD_SELECTOR') copyArtifacts fingerprintArtifacts: true, projectName: 's430705-create-dataset', selector: buildParameter('BUILD_SELECTOR')
sh 'python3 lab06_training.py' sh 'python3 lab06_training.py $epochs'
sh 'ls -l'
sh 'pwd'
} }
} }
@ -22,12 +25,22 @@ pipeline {
archiveArtifacts 'model_movies/**' archiveArtifacts 'model_movies/**'
} }
} }
stage('Send notification'){ }
steps{
emailext body: currentBuild.result ?: 'SUCCESS +1 YEA', post {
subject: 's43705', success {
emailtext body: 'SUCCESS',
subject: 's430705',
to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' 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'
} }
} }
} }

View File

@ -1,3 +1,4 @@
import sys
import string import string
import pandas as pd import pandas as pd
from sklearn.model_selection import train_test_split 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) 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( model.fit(
x=X_train.values, x=X_train.values,