From b5daa4256de0d291c33bfac28e91cb3e7d438e23 Mon Sep 17 00:00:00 2001 From: patrycjalazna Date: Fri, 7 May 2021 17:43:06 +0200 Subject: [PATCH] Jenkinsfile-training changed, automatic mail sending --- Jenkinsfile-training | 24 ++++++++++++++++-------- avocado-preprocessing.py | 1 + 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile-training b/Jenkinsfile-training index 0d21177..11f6e2d 100644 --- a/Jenkinsfile-training +++ b/Jenkinsfile-training @@ -9,14 +9,14 @@ pipeline { defaultSelector: lastSuccessful(), description: 'Which build to use for copying artifacts', name: 'BUILD_SELECTOR' - ) - string( + ) + string( defaultValue: '16', description: 'batch size', name: 'BATCH_SIZE' ) string( - defaultValue: '15', + defaultValue: '10', description: 'epochs', name: 'EPOCHS' ) @@ -27,18 +27,26 @@ pipeline { copyArtifacts fingerprintArtifacts: true, projectName: 's434742-create-dataset', selector: buildParameter('BUILD_SELECTOR') } } - stage('Sh script') { + stage('training') { steps { - sh 'chmod +x run_training-script.sh' - sh './run_training-script.sh ${EPOCHS} ${BATCH_SIZE}' + sh 'chmod +x avocado-preprocessing.py' + sh 'python3 avocado-preprocessing.py ${EPOCHS} ${BATCH_SIZE}' } } - stage('Archive artifacts') { + stage('archiveArtifacts') { steps{ - archiveArtifacts artifacts: 'model_movies' + archiveArtifacts 'avocado-model.h5' } } + + stage('sendMail') { + steps{ + emailext body: currentBuild.result ?: 'SUCCESS', + subject: 's434742', + to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' + } + } } } \ No newline at end of file diff --git a/avocado-preprocessing.py b/avocado-preprocessing.py index 90cd693..f7fd244 100644 --- a/avocado-preprocessing.py +++ b/avocado-preprocessing.py @@ -99,6 +99,7 @@ epochs = int(sys.argv[1]) batch_size = int(sys.argv[2]) model.fit(X_train, y_train, epochs=epochs, batch_size=batch_size, validation_data=(X_test, y_test)) +model.save('avocado-model.h5') # predict predictions = model.predict(X_test)