Task 2 Part 2
Some checks failed
s444517-training/pipeline/head This commit looks good
s444517-evaluation/pipeline/head There was a failure building this commit

This commit is contained in:
Kamila 2022-05-03 18:41:33 +02:00
parent 3581fdd323
commit 599b1be807
3 changed files with 24 additions and 12 deletions

View File

@ -3,11 +3,12 @@ pipeline {
dockerfile true
}
parameters {
string(
defaultValue: '200',
description: 'number of epochs',
name: 'EPOCH'
)
gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH'
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR'
)
}
stages {
@ -20,7 +21,7 @@ pipeline {
stage('Copy from different Pipeline') {
steps {
copyArtifacts fingerprintArtifacts: true, projectName: 's444517-create-dataset', selector: lastSuccessful()
copyArtifacts fingerprintArtifacts: true, projectName: 's444517-training/master', selector: lastSuccessful()
copyArtifacts fingerprintArtifacts: true, projectName: 's444517-training/${BRANCH}', selector: buildParameter('BUILD_SELECTOR')
copyArtifacts fingerprintArtifacts: true, projectName: 's444517-evaluation/master', selector: lastSuccessful(), optional: true
}
}
@ -28,10 +29,17 @@ pipeline {
stage('Get data save artifacts') {
steps {
sh 'python3 ./nn_train_eval.py'
archiveArtifacts artifacts: 'my_model/saved_model.pb, metrics.txt, output.jpg'
archiveArtifacts artifacts: 'my_model/saved_model.pb, metrics.txt, output.jpg, current_results.txt'
}
}
}
post {
always {
def metrics = readFile(file: 'current_results.txt')
emailext body: "${currentBuild.currentResult} ${metrics}", subject: 's444517_build_status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
}
}
}

View File

@ -31,10 +31,10 @@ pipeline {
}
}
}
//post {
// always {
// emailext body: "${currentBuild.currentResult}", subject: 's444517_build_status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
// }
//}
post {
always {
emailext body: "${currentBuild.currentResult}", subject: 's444517_build_status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
}
}
}

View File

@ -19,6 +19,10 @@ def new_metrics():
acc = accuracy_score(y_true, y_pred)
recc = recall_score(y_true, y_pred, average='macro')
with open("current_results.txt", 'w') as f:
f.write(f"accuracy: {acc} recall: {recc}")
f.close()
with open("metrics.txt", 'a') as f:
f.write(f"{acc},{recc}\n")
f.close()