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 { pipeline {
agent any
parameters{ parameters{
string( string(
defaultValue: '64', defaultValue: '300',
description: 'Batch size used in gradient', description: 'EPOCHS',
name: 'BATCHSIZE',
trim: true
)
string(
defaultValue: '5',
description: 'Number of iterations',
name: 'EPOCHS', name: 'EPOCHS',
trim: true trim: false
)
gitParameter branchFilter: 'origin/(.*)', defaultValue: 'main', name: 'BRANCH', type: 'PT_BRANCH'
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR'
) )
} }
agent {
docker {
image 's444439-create-dataset'
}
}
stages { stages {
stage('Train model') { stage('Clear_Before') {
steps { 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 { stage('copy_artifacts') {
NOTIFICATION_ADDRESS = 'e19191c5.uam.onmicrosoft.com@emea.teams.ms' steps {
copyArtifacts(projectName: 'z-s444439-create-dataset', fingerprintArtifacts: true)
} }
post {
success {
emailext body: 'SUCCESS', subject: "${env.JOB_NAME}", to: "${env.NOTIFICATION_ADDRESS}"
} }
stage('Docker') {
failure { agent {
emailext body: 'FAILURE', subject: "${env.JOB_NAME}", to: "${env.NOTIFICATION_ADDRESS}" dockerfile {
filename 'Dockerfile'
dir 'ium_z444439'
reuseNode true
} }
unstable {
emailext body: 'UNSTABLE', subject: "${env.JOB_NAME}", to: "${env.NOTIFICATION_ADDRESS}"
} }
steps {
changed { sh 'python ./ium_z444439/train.py'
emailext body: 'CHANGED', subject: "${env.JOB_NAME}", to: "${env.NOTIFICATION_ADDRESS}" 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.fit(adults_train, adults_predict, epochs=500)
adult_model.save('model') adult_model.save('model')
if __name__ == "__main__":
main()