diff --git a/Jenkinsfile_training b/Jenkinsfile_training index 4cdea5b..71e09ab 100644 --- a/Jenkinsfile_training +++ b/Jenkinsfile_training @@ -1,58 +1,48 @@ pipeline { - parameters { - string( - defaultValue: '64', - description: 'Batch size used in gradient', - name: 'BATCHSIZE', - trim: true - ) - string( - defaultValue: '5', - description: 'Number of iterations', + agent any + parameters{ + string( + 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') { - steps { - sh "python neutral_network.py -e ${params.EPOCHS} -b ${params.BATCHSIZE}" + stage('Clear_Before') { + steps { + sh 'rm -rf *' + } + } + stage('Clone') { + steps { + sh 'git clone https://git.wmi.amu.edu.pl/s444439/ium_z444439' + } + } + + stage('copy_artifacts') { + steps { + copyArtifacts(projectName: 'z-s444439-create-dataset', fingerprintArtifacts: true) + } + } + stage('Docker') { + agent { + dockerfile { + filename 'Dockerfile' + dir 'ium_z444439' + reuseNode true } - } - } - - 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}" - } - } -} \ No newline at end of file + } + steps { + sh 'python ./ium_z444439/train.py' + archiveArtifacts 'model/' + archiveArtifacts 'X_test.csv' + archiveArtifacts 'Y_test.csv' + } + } + stage('Clear_After') { + steps { + sh 'rm -rf *' + } + } + } \ No newline at end of file diff --git a/train.py b/train.py index 6594e7f..0ffaebd 100644 --- a/train.py +++ b/train.py @@ -24,3 +24,7 @@ def main(): adult_model.fit(adults_train, adults_predict, epochs=500) adult_model.save('model') + + +if __name__ == "__main__": + main()