MLFlow Openshift Deployment Plugin
Project description
IMPORTANT NOTE: This package is no longer maintained and not adapted for mlflow>2.*.
Openshift Mlflow Deployment Plugin
Mlflow deployment plugin for openshift. This plugin offers the possibility to deploy mlflow packed models into openshift using the regular mlflow deployment
command line interface.
Installation
- Install the mlflow openshift plugin:
pip install mlflow-openshift
. - Make sure the openshift CLI tool is installed by calling
oc
in the command line. If not, you can find an installation tutorial here
Get Started
- Get your login token from the openshift web-ui and use it to log in. You can find it on the top right > question mark > about > command line tools.
oc login <token>
- Navigate to the openshift project you want to the deploy the model. Make sure you have admin priviliges in that project.
You can validate if your current user has admin rights for the project by executing this command:oc project <my-project>
oc get rolebindings admin -n <my-project>
- Setup the mlflow (and s3/minio) environment variables:
AWS_ACCESS_KEY_ID=<> AWS_SECRET_ACCESS_KEY=<> MLFLOW_S3_ENDPOINT_URL=<>
Create a Deployment
Creates all necessary artifacts for a model deployment in openshift, i.e. hosting the model in the specified container image and putting and nginx basic authentication proxy in front of the container to publisch an https endpoint.
The succesful deployment will return the created https host. Requests can be sent against mlflow's default /invocations
endpoint.
Mandatory config items
--name
--model-uri
--docker-registry
--image
--tag
--auth_user
--auth_password
Optional config items:
--cpu_limit -> default: `1`
--cpu_request -> default: `100m`
--mem_limit -> default: `512Mi`
--mem_request -> default: `256Mi`
--gunicorn_workers -> default: `1`
Example: MLflow CLI
mlflow deployments create -t openshift \
--name <name> \
--model-uri <model-uri>
--config docker_registry=<docker-registry> \
--config image=<image> \
--config tag=<tag>
Example: python mlflow API
from mlflow.deployments import get_deploy_client
target_uri = 'openshift'
openshift_client = get_deploy_client(target_uri)
openshift_client.create_deployment(
<name>,
<model-uri>,
"docker_registry": <docker_registry>,
"image": <image>,
"tag": <tag>
}
)
Updating an existing Deployment
Updates an existing model deployment in openshift. It can either update
the model_uri
and/or the config items describing the container image (all three of them need to be provided),
i.e image
, docker_registry
, tag
.
Example: MLflow CLI
mlflow deployments update -t openshift \
--name <name> \
--model-uri <model-uri>
Example: python mlflow API
from mlflow.deployments import get_deploy_client
target_uri = 'openshift'
openshift_client = get_deploy_client(target_uri)
openshift_client.update_deployment(
<name>,
model_uri=<model-uri>
)
Deleting a Deyployment
Deletes the deployment and resources (openshift artifacts like routes).
Example: MLflow CLI
mlflow deployments delete -t openshift --name <name>
Example: python mlflow API
from mlflow.deployments import get_deploy_client
target_uri = 'openshift'
openshift_client = get_deploy_client(target_uri)
openshift_client.delete_deployment(<name>)
Listing all Mlflow Deplyoments
Lists all mlflow deployments in the current openshift project.
Example: MLflow CLI
mlflow deployments list -t openshift
Example: python mlflow API
from mlflow.deployments import get_deploy_client
target_uri = 'openshift'
openshift_client = get_deploy_client(target_uri)
openshift_client.list_deployments()
Get Deplyoment Information
Retrieves raw, detailed information for the deployment.
Example: MLflow CLI
mlflow deployments get -t openshift --name <name>
Example: python mlflow API
from mlflow.deployments import get_deploy_client
target_uri = 'openshift'
openshift_client = get_deploy_client(target_uri)
openshift_client.get_deployment(<name>)
Predict with Deployment
Makes predictions using the specified deployment name. This can be used for making batch predictions using the openshift infrastrucutre, e.g. in automated daily/weekly pipelines. This option is only available for the python mlflow API. However, the REST endpoint can of course be called by and REST capable service.
Example: python mlflow API
For a iris flower dataset model
from mlflow.deployments import get_deploy_client
target_uri = 'openshift'
openshift_client = get_deploy_client(target_uri)
df = pd.DataFrame(
columns=["sepalLength", "sepalWidth", "petalWidth"],
data=[[0, 1, 0], [0, 1, 1]]
)
predictions = openshift_client.predict(<name>, df)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mlflow_openshift-0.2.3.tar.gz
.
File metadata
- Download URL: mlflow_openshift-0.2.3.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 097cd9b40e5a104e80559f6886e281814cecf92243637aef702b5487bcaf4f50 |
|
MD5 | ce77c6db006aa84e29c30fc650732678 |
|
BLAKE2b-256 | 82e4124375010ccaaaa8e23a6e64342cd0fb46ea902bf5c5b47568c739f40322 |
File details
Details for the file mlflow_openshift-0.2.3-py3-none-any.whl
.
File metadata
- Download URL: mlflow_openshift-0.2.3-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9379ba81bf92172c9ee60d85e89b66eb9bde5841ca22e63e572e15f05a1eb25 |
|
MD5 | 41fec83c120d6cc19c615f7c6ccda19c |
|
BLAKE2b-256 | 54510402c60bb6328c215fb1511059c3cbc187ca021e8fe8dba3fd194be6149a |