update dockerfile, add jenkinsfile_registry, registry.py
All checks were successful
s444356-evaluation/pipeline/head This commit looks good
s444356-training/pipeline/head This commit looks good

This commit is contained in:
Maciej Czajka 2022-05-11 20:49:26 +02:00
parent a9c0760e52
commit defc9740dd
3 changed files with 32 additions and 0 deletions

View File

@ -38,6 +38,7 @@ COPY Biblioteka_DL/dllib-sacred.py .
COPY Biblioteka_DL/evaluate.py .
COPY Biblioteka_DL/dllib-mlflow.py .
COPY predict.py .
COPY registry.py .
COPY Biblioteka_DL/all_games.csv .
RUN ./download.sh $CUTOFF

22
Jenkinsfile_registry Normal file
View File

@ -0,0 +1,22 @@
pipeline {
agent {
dockerfile {
additionalBuildArgs "--build-arg KAGGLE_USERNAME=${params.KAGGLE_USERNAME} --build-arg KAGGLE_KEY=${params.KAGGLE_KEY} --build-arg CUTOFF=${params.CUTOFF} -t maciejczajka"
}
}
parameters {
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts for predict',
name: 'BUILD_SELECTOR')
}
stages {
stage('Script') {
steps {
copyArtifacts projectName: 's444409-training/main', selector: buildParameter('BUILD_SELECTOR')
sh 'python3 ./registry.py'
}
}
}
}

9
registry.py Normal file
View File

@ -0,0 +1,9 @@
import mlflow
logged_model = '/mlruns/12/1c2b9737c0204b0ca825811c35fb6c64/artifacts/s444409'
# Load model as a PyFuncModel.
loaded_model = mlflow.pyfunc.load_model(logged_model)
# Predict on a Pandas DataFrame.
import pandas as pd
print(f'Prediction: {loaded_model.predict(pd.DataFrame(data))}')