ium_444452/Jenkins/Jenkinsfile.training
AdamOsiowy123 75755f02b3
Some checks failed
s444452-training/pipeline/head This commit looks good
s444452-evaluation/pipeline/head There was a failure building this commit
fix
2022-05-04 22:01:28 +02:00

52 lines
1.9 KiB
Plaintext

node {
checkout scm
try {
docker.image('s444452/ium:1.3').inside {
stage('Preparation') {
properties([
pipelineTriggers([upstream(threshold: hudson.model.Result.SUCCESS, upstreamProjects: "s444452-create-dataset")]),
parameters([
string(
defaultValue: ".,14000,1,50,100",
description: 'Train params: data_path,num_words,epochs,batch_size,pad_length',
name: 'TRAIN_PARAMS'
)
])
])
}
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'
}
stage('Run script') {
withEnv(["TRAIN_PARAMS=${params.TRAIN_PARAMS}"]) {
sh "python3 Scripts/train_neural_network.py $TRAIN_PARAMS"
}
}
stage('Archive artifacts') {
archiveArtifacts "model/neural_net"
}
}
} 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 details = "Build nr: ${env.BUILD_NUMBER}, status: ${buildStatus} \n url: ${env.BUILD_URL} \n build params: ${params.TRAIN_PARAMS}"
if (buildStatus == 'SUCCESS') {
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
}
emailext (
subject: subject,
body: details,
to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
)
}