From eb520d69b7502b4626f1322e35f8df0e0dd07975 Mon Sep 17 00:00:00 2001 From: Maciej Sobkowiak Date: Sun, 16 May 2021 16:53:00 +0200 Subject: [PATCH] Arguments --- train.Jenkinsfile | 29 +++++++++++++++++++++++++++-- training.py | 3 ++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/train.Jenkinsfile b/train.Jenkinsfile index b90729d..bd8296e 100644 --- a/train.Jenkinsfile +++ b/train.Jenkinsfile @@ -1,14 +1,39 @@ pipeline { agent any; + parameters{ + buildSelector( + defaultSelector: lastSuccessful(), + description: 'Which build to use for copying artifacts', + name: 'BUILD_SELECTOR' + ) + string( + defaultValue: '10', + description: 'batch size', + name: 'BATCH_SIZE' + ) + string( + defaultValue: '5', + description: 'epochs', + name: 'EPOCHS' + + ) + } + stages{ + stage('artifacts') { + steps { + copyArtifacts fingerprintArtifacts: true, projectName: 's434784-create-dataset', selector: buildParameter('BUILD_SELECTOR') + } + } + stage('docker-training') { steps { script { def image = docker.build('dock') image.inside{ sh 'chmod +x training.py' - sh 'python3 training.py' - + sh 'python3 training.py ${EPOCHS} ${BATCH_SIZE}' + } } } diff --git a/training.py b/training.py index d912493..d01674a 100644 --- a/training.py +++ b/training.py @@ -64,7 +64,8 @@ model.compile( # Train model history = model.fit( X_train, y_train, - epochs=30, + batch_size=sys.argv[0], + epochs=sys.argv[1], validation_split=0.2) test_results = {}