From eb1614b5e1ad24996cda60374e70edb19371687c Mon Sep 17 00:00:00 2001 From: Dawid Date: Sun, 23 May 2021 18:44:24 +0200 Subject: [PATCH] handle coop model build --- Jenkinsfile_mlflow | 2 +- Jenkinsfile_mlflow_coop | 36 ++++++++++++++++++++++++++++++++++++ mlflow_model.py | 2 -- 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 Jenkinsfile_mlflow_coop diff --git a/Jenkinsfile_mlflow b/Jenkinsfile_mlflow index 2e9b3a4..cc7cf55 100644 --- a/Jenkinsfile_mlflow +++ b/Jenkinsfile_mlflow @@ -15,7 +15,7 @@ pipeline { } stage('training') { steps { - sh 'rm -rf country_vaccination' + sh 'rm -rf movies_imdb' sh 'chmod +x pred_from_model.py' sh 'python3 pred_from_model.py' } diff --git a/Jenkinsfile_mlflow_coop b/Jenkinsfile_mlflow_coop new file mode 100644 index 0000000..be28965 --- /dev/null +++ b/Jenkinsfile_mlflow_coop @@ -0,0 +1,36 @@ +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: 's430705-training/master', selector: buildParameter('BUILD_SELECTOR') + } + } + stage('training') { + steps { + sh 'rm -rf movies_imdb' + sh 'chmod +x pred_from_mlflow_model.py' + sh 'python3 pred_from_mlflow_model.py' + } + } + stage('archiveArtifacts') { + steps{ + archiveArtifacts 'movies_imdb/**' + } + } + stage('sendMail') { + steps{ + emailext body: currentBuild.result ?: 'MLFLOW PREDICT SUCCESS', + subject: 's434804', + to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' + } + } + } +} \ No newline at end of file diff --git a/mlflow_model.py b/mlflow_model.py index e989f76..ec39dd8 100644 --- a/mlflow_model.py +++ b/mlflow_model.py @@ -57,10 +57,8 @@ if __name__ == "__main__": mlf.set_experiment("s434804") tracking_url_type_store = urlparse(mlf.get_tracking_uri()).scheme if tracking_url_type_store != "file": - print("no file") mlf.keras.log_model(model, "country_vaccination2", registered_model_name="s434804", signature=signature, input_example=input_example) else: - print("file") mlf.keras.log_model(model, "vaccines_model", signature=signature, input_example=input_example) mlf.keras.save_model(model, "country_vaccination", signature=signature, input_example=input_example) \ No newline at end of file