ium_s449288/lab7/Jenkinsfile_eval

63 lines
2.6 KiB
Plaintext
Raw Normal View History

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