pipeline { agent { docker { image 's478841-image:latest' args '-v /mlruns:/mlruns' } } parameters { string( defaultValue: '140', description: 'epochs number', name: 'epochs' ) string( defaultValue: '10', description: 'Number of training steps between loss values logging', name: 'step' ) string ( defaultValue: '--save', description: 'save model after training', name: 'save_model' ) } stages { stage('Checkout') { steps { checkout([$class: 'GitSCM', branches: [[name: '*/develop']], extensions: [], userRemoteConfigs: [ [url: 'https://git.wmi.amu.edu.pl/s478841/ium_478841.git']]]) } } stage('Copy Artifacts') { steps { copyArtifacts filter: 'data/avocado.data*', fingerprintArtifacts: true, projectName: 's478841-create-dataset', selector: lastSuccessful() } } stage('Model training') { steps { sh "chmod +x -R ${env.WORKSPACE}" sh 'python3 scripts/sacred_train.py -e $epochs -s $step $save_model' sh 'python3 scripts/mlflow_train.py -e $epochs -s $step $save_model' } } stage('Archive artifacts') { steps { archiveArtifacts artifacts: 'mlruns/**', onlyIfSuccessful: true archiveArtifacts artifacts: '*data/predictions.csv', onlyIfSuccessful: true archiveArtifacts artifacts: '*data/model_scripted*', onlyIfSuccessful: true dir('data/training_runs') { archiveArtifacts artifacts: '**/**', onlyIfSuccessful: true } } } } post { success { emailext body: 'SUCCESS', subject: "${env.JOB_NAME}", to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms' build job: 's478841-evaluation/develop' } failure { emailext body: 'FAILURE', subject: "${env.JOB_NAME}", to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms' } unstable { emailext body: 'UNSTABLE', subject: "${env.JOB_NAME}", to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms' } changed { emailext body: 'CHANGED', subject: "${env.JOB_NAME}", to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms' } } }