add new jenkinsfile with training

This commit is contained in:
Klaudia 2023-05-11 18:55:10 +02:00
parent eca972066a
commit 643e52a372
2 changed files with 47 additions and 53 deletions

View File

@ -1,58 +1,48 @@
pipeline {
parameters {
agent any
parameters{
string(
defaultValue: '64',
description: 'Batch size used in gradient',
name: 'BATCHSIZE',
trim: true
)
string(
defaultValue: '5',
description: 'Number of iterations',
defaultValue: '300',
description: 'EPOCHS',
name: 'EPOCHS',
trim: true
)
gitParameter branchFilter: 'origin/(.*)', defaultValue: 'main', name: 'BRANCH', type: 'PT_BRANCH'
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR'
trim: false
)
}
agent {
docker {
image 's444439-create-dataset'
}
}
stages {
stage('Train model') {
stage('Clear_Before') {
steps {
sh "python neutral_network.py -e ${params.EPOCHS} -b ${params.BATCHSIZE}"
sh 'rm -rf *'
}
}
stage('Clone') {
steps {
sh 'git clone https://git.wmi.amu.edu.pl/s444439/ium_z444439'
}
}
environment {
NOTIFICATION_ADDRESS = 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
}
post {
success {
emailext body: 'SUCCESS', subject: "${env.JOB_NAME}", to: "${env.NOTIFICATION_ADDRESS}"
}
failure {
emailext body: 'FAILURE', subject: "${env.JOB_NAME}", to: "${env.NOTIFICATION_ADDRESS}"
}
unstable {
emailext body: 'UNSTABLE', subject: "${env.JOB_NAME}", to: "${env.NOTIFICATION_ADDRESS}"
}
changed {
emailext body: 'CHANGED', subject: "${env.JOB_NAME}", to: "${env.NOTIFICATION_ADDRESS}"
stage('copy_artifacts') {
steps {
copyArtifacts(projectName: 'z-s444439-create-dataset', fingerprintArtifacts: true)
}
}
stage('Docker') {
agent {
dockerfile {
filename 'Dockerfile'
dir 'ium_z444439'
reuseNode true
}
}
steps {
sh 'python ./ium_z444439/train.py'
archiveArtifacts 'model/'
archiveArtifacts 'X_test.csv'
archiveArtifacts 'Y_test.csv'
}
}
stage('Clear_After') {
steps {
sh 'rm -rf *'
}
}
}
}

View File

@ -24,3 +24,7 @@ def main():
adult_model.fit(adults_train, adults_predict, epochs=500)
adult_model.save('model')
if __name__ == "__main__":
main()