ium_s449288/lab6/Jenkinsfile_eval

59 lines
2.5 KiB
Plaintext
Raw Normal View History

2022-04-24 15:07:23 +02:00
pipeline {
agent {
dockerfile true
}
2022-04-26 14:56:10 +02:00
parameters {
gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH'
2022-04-26 19:17:10 +02:00
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR'
)
2022-04-26 14:56:10 +02:00
}
2022-04-24 15:07:23 +02:00
stages {
stage('Stage 1') {
steps {
2022-04-26 15:06:50 +02:00
git branch: "${params.BRANCH}", url: 'https://git.wmi.amu.edu.pl/s449288/ium_s449288.git'
2022-04-25 22:07:19 +02:00
sh 'chmod u+x ./evaluate.py'
echo 'Copying datasets from the create-dataset job...'
copyArtifacts filter: 'lego_sets_clean_test.csv', projectName: 's449288-create-dataset'
echo 'Datasets copied'
echo 'Copying model from the training job...'
2022-04-26 19:17:10 +02:00
copyArtifacts filter: 'lego_reg_model.tar.gz', projectName: 's449288-training/master/', selector: buildParameter('BUILD_SELECTOR')
2022-04-25 22:07:19 +02:00
echo 'Model copied'
sh 'tar xvzf lego_reg_model.tar.gz'
echo 'Optional copying of the metrics file from previous build...'
2022-04-26 16:17:39 +02:00
copyArtifacts filter: 'eval_results.txt', projectName: 's449288-evaluation/master/', optional: true
2022-04-25 22:53:03 +02:00
echo 'Metrics file copied if it did not exist'
2022-04-25 22:07:19 +02:00
echo 'Evaluating model...'
sh 'python3 evaluate.py'
echo 'Model evaluated. Metrics saved. Plot saved.'
sh 'head eval_results.txt'
sh 'file error_plot.jpg'
echo 'Archiving metrics file...'
archiveArtifacts 'eval_results.txt'
echo 'File archived'
2022-04-26 22:36:30 +02:00
script {
LAST_MAE = sh (
script: 'tail -1 eval_results.txt',
returnStdout: true
).trim()
}
2022-04-24 15:07:23 +02:00
}
}
2022-04-24 17:51:33 +02:00
}
2022-04-25 22:07:19 +02:00
post {
2022-04-24 17:51:33 +02:00
success {
2022-04-26 23:04:58 +02:00
emailext body: "SUCCESS - ${LAST_MAE} MAE", subject: 's449288-evaluation build status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
2022-04-24 17:51:33 +02:00
}
failure {
2022-04-26 23:04:58 +02:00
emailext body: "FAILURE - ${LAST_MAE} MAE", subject: 's449288-evaluation build status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
2022-04-24 17:51:33 +02:00
}
unstable {
2022-04-26 23:04:58 +02:00
emailext body: "UNSTABLE - ${LAST_MAE} MAE", subject: 's449288-evaluation build status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
2022-04-24 17:51:33 +02:00
}
changed {
2022-04-26 23:04:58 +02:00
emailext body: "CHANGED - ${LAST_MAE} MAE", subject: 's449288-evaluation build status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
2022-04-24 15:07:23 +02:00
}
2022-04-24 17:51:33 +02:00
}
2022-04-24 15:07:23 +02:00
}