added Jenkinsfile_train and model saving
Some checks failed
s434804-training/pipeline/head There was a failure building this commit

This commit is contained in:
Dawid 2021-05-10 19:36:19 +02:00
parent 8c8a6b0376
commit d566b3869a
2 changed files with 38 additions and 1 deletions

35
Jenkisfile_train Normal file
View File

@ -0,0 +1,35 @@
pipeline {
agent {dockerfile true}
parameters {
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR'
)
}
stages {
stage('copyArtifacts') {
steps {
copyArtifacts fingerprintArtifacts: true, projectName: 's434804-create-dataset', selector: buildParameter('BUILD_SELECTOR')
}
}
stage('training') {
steps {
sh 'chmod +x tensor.py'
sh 'python tensor.py'
}
}
stage('archiveArtifacts') {
steps{
archiveArtifacts 'vaccines_model/saved_model.pb'
}
}
stage('sendMail') {
steps{
emailext body: currentBuild.result ?: 'TRAINING SUCCESS',
subject: 's434804',
to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
}
}
}
}

View File

@ -2,6 +2,7 @@ import numpy as np
import pandas as pd import pandas as pd
import tensorflow as tf import tensorflow as tf
import sys import sys
import wget
from tensorflow import keras from tensorflow import keras
from sklearn.metrics import r2_score, mean_squared_error from sklearn.metrics import r2_score, mean_squared_error
from math import sqrt from math import sqrt
@ -39,4 +40,5 @@ model.fit(X_train, y_train, epochs=50, validation_split = 0.3)
prediction = model.predict(X_test) prediction = model.predict(X_test)
print(prediction) print(prediction)
sys.stdout.close() sys.stdout.close()
model.save('vaccines_model')