Skip to main content

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

  1. Install the mlflow openshift plugin: pip install mlflow-openshift.
  2. 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

  1. 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>
    
  2. Navigate to the openshift project you want to the deploy the model. Make sure you have admin priviliges in that project.
    oc project <my-project>
    
    You can validate if your current user has admin rights for the project by executing this command:
    oc get rolebindings admin -n <my-project>
    
  3. 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)

Metadata

Release files for mlflow-openshift 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mlflow-openshift 0.2.3
File Size Uploaded Provenance Actions
mlflow_openshift-0.2.3.tar.gz 16.4 kB Without provenance Details for mlflow_openshift-0.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mlflow-openshift 0.2.3
File Interpreter ABI Platform Actions
mlflow_openshift-0.2.3-py3-none-any.whl Python 3 none any Details for mlflow_openshift-0.2.3-py3-none-any.whl

Total release size: 36.7 kB

Release files / mlflow_openshift-0.2.3.tar.gz

Download URL mlflow_openshift-0.2.3.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
097cd9b40e5a104e80559f6886e281814cecf92243637aef702b5487bcaf4f50
BLAKE2b-256 checksum
How to use checksums
82e4124375010ccaaaa8e23a6e64342cd0fb46ea902bf5c5b47568c739f40322
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / mlflow_openshift-0.2.3-py3-none-any.whl

Download URL mlflow_openshift-0.2.3-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9379ba81bf92172c9ee60d85e89b66eb9bde5841ca22e63e572e15f05a1eb25
BLAKE2b-256 checksum
How to use checksums
54510402c60bb6328c215fb1511059c3cbc187ca021e8fe8dba3fd194be6149a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Security for mlflow-openshift 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page