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,10 +3,11 @@ pipeline {
dockerfile true dockerfile true
} }
parameters { parameters {
string( gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH'
defaultValue: '200', buildSelector(
description: 'number of epochs', defaultSelector: lastSuccessful(),
name: 'EPOCH' description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR'
) )
} }
@ -20,7 +21,7 @@ pipeline {
stage('Copy from different Pipeline') { stage('Copy from different Pipeline') {
steps { steps {
copyArtifacts fingerprintArtifacts: true, projectName: 's444517-create-dataset', selector: lastSuccessful() 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 copyArtifacts fingerprintArtifacts: true, projectName: 's444517-evaluation/master', selector: lastSuccessful(), optional: true
} }
} }
@ -28,10 +29,17 @@ pipeline {
stage('Get data save artifacts') { stage('Get data save artifacts') {
steps { steps {
sh 'python3 ./nn_train_eval.py' 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 { post {
// always { always {
// emailext body: "${currentBuild.currentResult}", subject: 's444517_build_status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms' 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) acc = accuracy_score(y_true, y_pred)
recc = recall_score(y_true, y_pred, average='macro') 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: with open("metrics.txt", 'a') as f:
f.write(f"{acc},{recc}\n") f.write(f"{acc},{recc}\n")
f.close() f.close()