2022-05-03 00:04:19 +02:00
|
|
|
node {
|
|
|
|
checkout scm
|
|
|
|
try {
|
|
|
|
docker.image('s444452/ium:1.3').inside {
|
|
|
|
stage('Preparation') {
|
|
|
|
properties([
|
|
|
|
parameters([
|
2022-05-04 18:57:18 +02:00
|
|
|
gitParameter(
|
|
|
|
branchFilter: 'origin/(.*)',
|
|
|
|
defaultValue: 'master',
|
|
|
|
description: 'Select branch',
|
|
|
|
name: 'BRANCH',
|
|
|
|
type: 'PT_BRANCH'
|
|
|
|
),
|
2022-05-04 19:27:40 +02:00
|
|
|
buildSelector(
|
|
|
|
defaultSelector: upstream(),
|
|
|
|
description: 'Which build to use for copying artifacts',
|
|
|
|
name: 'BUILD_SELECTOR'
|
2022-05-04 18:08:52 +02:00
|
|
|
),
|
2022-05-03 00:04:19 +02:00
|
|
|
string(
|
2022-05-04 18:08:52 +02:00
|
|
|
defaultValue: ".,14000,1,50,100",
|
|
|
|
description: 'Test params: data_path,num_words,epochs,batch_size,pad_length',
|
|
|
|
name: 'TEST_PARAMS'
|
2022-05-04 20:05:40 +02:00
|
|
|
),
|
|
|
|
string(
|
|
|
|
defaultValue: "0",
|
|
|
|
description: 'Build number',
|
|
|
|
name: 'BUILD_NR'
|
2022-05-03 00:04:19 +02:00
|
|
|
)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
}
|
|
|
|
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'
|
2022-05-04 18:08:52 +02:00
|
|
|
git branch: "${params.BRANCH}", url: 'https://git.wmi.amu.edu.pl/s444452/ium_444452.git'
|
|
|
|
copyArtifacts filter: 'neural_network_evaluation.csv', projectName: "s444452-evaluation/${BRANCH}/", optional: true
|
2022-05-04 19:27:40 +02:00
|
|
|
copyArtifacts filter: 'model/neural_net', projectName: "s444452-training/${BRANCH}/", selector: buildParameter('BUILD_SELECTOR')
|
2022-05-03 00:04:19 +02:00
|
|
|
}
|
|
|
|
stage('Run script') {
|
2022-05-04 20:13:33 +02:00
|
|
|
withEnv(["TEST_PARAMS=${params.TEST_PARAMS}", "BUILD_NR=${params.BUILD_NR}"]) {
|
|
|
|
sh "python3 Scripts/evaluate_neural_network.py $BUILD_NR $TEST_PARAMS"
|
2022-05-03 00:04:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Archive artifacts') {
|
2022-05-04 19:32:49 +02:00
|
|
|
archiveArtifacts "neural_network_evaluation.csv, evaluation.png"
|
2022-05-03 00:04:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} 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}"
|
2022-05-04 20:13:33 +02:00
|
|
|
def lines= new File("./neural_network_evaluation.csv").readLines()
|
|
|
|
def lastline=lines.get(lines.size()-1)
|
|
|
|
def details = "Build nr: ${env.BUILD_NUMBER}, status: ${buildStatus} \n url: ${env.BUILD_URL} \n build params: ${params.TEST_PARAMS} \n metrics: ${lastline}"
|
2022-05-03 00:04:19 +02:00
|
|
|
|
|
|
|
emailext (
|
|
|
|
subject: subject,
|
|
|
|
body: details,
|
|
|
|
to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
|
|
|
|
)
|
|
|
|
}
|