ium_444452/Jenkins/Jenkinsfile.training

87 lines
3.3 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-08 13:35:38 +02:00
defaultValue: ".",
description: 'Data path',
name: 'DATA_PATH'
),
string(
defaultValue: "1",
description: 'EPOCHS',
name: 'EPOCHS'
),
string(
defaultValue: "20000",
description: 'Num words',
name: 'NUM_WORDS'
),
string(
defaultValue: "1000",
description: 'Batch size',
name: 'BATCH_SIZE'
),
string(
defaultValue: "2000",
description: 'Pad length',
name: 'PAD_LENGTH'
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-08 13:35:38 +02:00
withEnv(["DATA_PATH=${params.DATA_PATH}","EPOCHS=${params.EPOCHS}","NUM_WORDS=${params.NUM_WORDS}",
"BATCH_SIZE=${params.BATCH_SIZE}","PAD_LENGTH=${params.PAD_LENGTH}"]) {
sh "python3 Scripts/train_neural_network.py $DATA_PATH $EPOCHS $NUM_WORDS $BATCH_SIZE $PAD_LENGTH"
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-08 13:35:38 +02:00
archiveArtifacts "my_runs/**"
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-08 13:35:38 +02:00
def build_params = "Path: ${params.DATA_PATH}, Epochs: ${params.EPOCHS}, Num_words: ${params.NUM_WORDS}, Batch_size: ${params.BATCH_SIZE}, Pad_length: ${params.PAD_LENGTH}"
def details = "Build nr: ${env.BUILD_NUMBER}, status: ${buildStatus} \n url: ${env.BUILD_URL} \n build params: ${build_params}"
2022-05-02 22:28:46 +02:00
2022-05-04 18:08:52 +02:00
if (buildStatus == 'SUCCESS') {
2022-05-04 23:00:44 +02:00
build (
job: "s444452-evaluation/${env.BRANCH_NAME}",
parameters: [
gitParameter(name: "BRANCH", value: "${env.BRANCH_NAME}"),
2022-05-08 13:35:38 +02:00
string(name: "BUILD_NR", value: "${env.BUILD_NUMBER}"),
string(name: "DATA_PATH", value: "${params.DATA_PATH}"),
string(name: "EPOCHS", value: "${params.EPOCHS}"),
string(name: "NUM_WORDS", value: "${params.NUM_WORDS}"),
string(name: "BATCH_SIZE", value: "${params.BATCH_SIZE}"),
string(name: "PAD_LENGTH", value: "${params.PAD_LENGTH}")
2022-05-04 23:00:44 +02:00
],
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
}