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: ".", description: 'Data path', name: 'DATA_PATH' ), string( defaultValue: "1", description: 'EPOCHS', name: 'EPOCHS' ), string( defaultValue: "20000", description: 'Num words', name: 'NUM_WORDS' ), string( defaultValue: "150", description: 'Batch size', name: 'BATCH_SIZE' ), string( defaultValue: "300", description: 'Pad length', name: 'PAD_LENGTH' ) ]) ]) } 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(["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" } } stage('Archive artifacts') { archiveArtifacts "model/neural_net" archiveArtifacts "my_runs/**" } } } 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 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}" if (buildStatus == 'SUCCESS') { build ( job: "s444452-evaluation/${env.BRANCH_NAME}", parameters: [ gitParameter(name: "BRANCH", value: "${env.BRANCH_NAME}"), 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}") ], wait: false ) } emailext ( subject: subject, body: details, to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms' ) }