Registry?

This commit is contained in:
Dominik Strzako 2021-05-24 00:57:03 +02:00
parent 555fd59a49
commit 4f5e6e7cd3
3 changed files with 70 additions and 0 deletions

48
Jenkinsfile_predict_r Normal file
View File

@ -0,0 +1,48 @@
pipeline {
agent {docker { image 'snowycocoon/ium_434788:4'}}
parameters{
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'WHICH_BUILD'
)
}
stages {
stage('copy artifacts')
{
steps
{
sh 'rm -r my_model'
sh 'rm -r model'
copyArtifacts(fingerprintArtifacts: true, projectName: 's434695-training/train', selector: buildParameter('WHICH_BUILD'))
}
}
stage('predict')
{
steps
{
catchError {
sh 'python3.8 Zadanie_09_MLflow_Predict_Registry.py ${BATCH_SIZE} ${EPOCHS}'
}
}
}
}
post {
success {
mail body: 'SUCCESS',
subject: 's434788 mlflow predict from registry',
to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
}
unstable {
mail body: 'UNSTABLE', subject: 's434788 mlflow predict from registry', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
}
failure {
mail body: 'FAILURE', subject: 's434788 mlflow predict from registry', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
}
changed {
mail body: 'CHANGED', subject: 's434788 mlflow predict from registry', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
}
}
}

View File

@ -32,6 +32,7 @@ pipeline {
{
catchError {
sh 'rm -r my_model'
sh 'rm -r model'
sh 'python3.8 Zadanie_08_and_09_MLflow.py ${BATCH_SIZE} ${EPOCHS}'
}
}

View File

@ -0,0 +1,21 @@
from mlflow.tracking import MlflowClient
import mlflow
import pandas as pd
mlflow.set_tracking_uri("http://172.17.0.1:5000")
client = MlflowClient()
version = 0
model_name = "s434695"
for mv in client.search_model_versions(f"name='{model_name}'"):
if int(mv.version) > version:
version = int(mv.version)
model = mlflow.pytorch.load_model(
model_uri=f"models:/{model_name}/{version}"
)
data = pd.read_json('my_model/input_example.json', orient='split')
print(data)
print(model.predict(data))