ium_444452/Jenkins/Jenkinsfile.evaluation
AdamOsiowy123 1a51256e4d
All checks were successful
s444452-training/pipeline/head This commit looks good
s444452-evaluation/pipeline/head This commit looks good
final
2022-05-04 23:04:59 +02:00

76 lines
2.8 KiB
Plaintext

node {
checkout scm
try {
docker.image('s444452/ium:1.3').inside {
stage('Preparation') {
properties([
parameters([
gitParameter(
branchFilter: 'origin/(.*)',
defaultValue: 'master',
description: 'Select branch',
name: 'BRANCH',
type: 'PT_BRANCH'
),
buildSelector(
defaultSelector: upstream(),
description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR'
),
string(
defaultValue: ".,14000,1,50,100",
description: 'Test params: data_path,num_words,epochs,batch_size,pad_length',
name: 'TEST_PARAMS'
),
string(
defaultValue: "0",
description: 'Build number',
name: 'BUILD_NR'
)
])
])
}
stage('Copy artifacts') {
copyArtifacts filter: 'train_data.csv', fingerprintArtifacts: true, projectName: 's444452-create-dataset'
copyArtifacts filter: 'test_data.csv', fingerprintArtifacts: true, projectName: 's444452-create-dataset'
copyArtifacts filter: 'neural_network_evaluation.csv', projectName: "s444452-evaluation/${params.BRANCH}", optional: true
copyArtifacts filter: 'model/neural_net', projectName: "s444452-training/${params.BRANCH}", selector: buildParameter('BUILD_SELECTOR')
}
stage('Run script') {
withEnv(["TEST_PARAMS=${params.TEST_PARAMS}", "BUILD_NR=${params.BUILD_NR}"]) {
sh "python3 Scripts/evaluate_neural_network.py $BUILD_NR $TEST_PARAMS"
}
}
stage('Archive artifacts') {
archiveArtifacts "neural_network_evaluation.csv, evaluation.png"
}
}
} catch (e) {
currentBuild.result = "FAILED"
throw e
} finally {
notifyBuild(currentBuild.result)
}
}
def notifyBuild(String buildStatus = 'STARTED') {
buildStatus = buildStatus ?: 'SUCCESS'
def subject = "Job: ${env.JOB_NAME}"
def lastline = ""
try {
def filePath = readFile "${WORKSPACE}/neural_network_evaluation.csv"
def lines = filePath.readLines()
lastline = lines.get(lines.size()-1)
}
catch (e) {
println(e.toString())
}
def details = "Build nr: ${env.BUILD_NUMBER}, status: ${buildStatus} \n url: ${env.BUILD_URL} \n build params: ${params.TEST_PARAMS} \n metrics: ${lastline}"
emailext (
subject: subject,
body: details,
to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
)
}