ium_444452/Jenkins/Jenkinsfile.training

52 lines
1.9 KiB
Plaintext
Raw Normal View History

2022-05-02 17:37:51 +02:00
node {
checkout scm
2022-05-02 22:28:46 +02:00
try {
docker.image('s444452/ium:1.3').inside {
2022-05-02 17:37:51 +02:00
stage('Preparation') {
properties([
2022-05-02 18:25:14 +02:00
pipelineTriggers([upstream(threshold: hudson.model.Result.SUCCESS, upstreamProjects: "s444452-create-dataset")]),
2022-05-02 17:37:51 +02:00
parameters([
string(
2022-05-02 22:51:16 +02:00
defaultValue: ".,14000,1,50,100",
description: 'Train params: data_path,num_words,epochs,batch_size,pad_length',
name: 'TRAIN_PARAMS'
2022-05-02 17:37:51 +02:00
)
])
])
}
2022-05-02 18:25:14 +02:00
stage('Copy artifacts') {
2022-05-02 18:49:07 +02:00
copyArtifacts filter: 'train_data.csv', fingerprintArtifacts: true, projectName: 's444452-create-dataset'
copyArtifacts filter: 'test_data.csv', fingerprintArtifacts: true, projectName: 's444452-create-dataset'
2022-05-02 18:25:14 +02:00
}
2022-05-02 17:37:51 +02:00
stage('Run script') {
2022-05-02 22:53:51 +02:00
withEnv(["TRAIN_PARAMS=${params.TRAIN_PARAMS}"]) {
2022-05-02 22:51:16 +02:00
sh "python3 Scripts/train_neural_network.py $TRAIN_PARAMS"
2022-05-02 17:37:51 +02:00
}
}
2022-05-02 18:49:07 +02:00
stage('Archive artifacts') {
2022-05-04 12:27:39 +02:00
archiveArtifacts "model/neural_net"
2022-05-02 18:49:07 +02:00
}
2022-05-02 19:33:02 +02:00
}
2022-05-02 22:28:46 +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-02 22:51:16 +02:00
def details = "Build nr: ${env.BUILD_NUMBER}, status: ${buildStatus} \n url: ${env.BUILD_URL} \n build params: ${params.TRAIN_PARAMS}"
2022-05-02 22:28:46 +02:00
2022-05-04 18:08:52 +02:00
if (buildStatus == 'SUCCESS') {
2022-05-04 22:01:28 +02:00
build job: "s444452-evaluation/${env.BRANCH_NAME}", parameters: [string(name: "TEST_PARAMS", value: "${params.TRAIN_PARAMS}"), string(name: "BUILD_NR", value: "${env.BUILD_NUMBER}")], wait: false
2022-05-04 18:08:52 +02:00
}
2022-05-02 22:28:46 +02:00
emailext (
subject: subject,
body: details,
2022-05-02 22:31:50 +02:00
to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
2022-05-02 22:28:46 +02:00
)
2022-05-02 17:37:51 +02:00
}