MLOps Python client¶
The MLOps Python client lets you use the MLOps API from your Python application. This guide describes how you can install the MLOps Python client, connect to MLOps and carry out tasks using the Python client. After successful installation, you can interact with the MLOps API via the MLOps gRPC Gateway. API specifications can be seen by accessing the MLOps gRPC Gateway URL via a browser.
Note
If you are not sure how to access the MLOps gRPC Gateway, please contact your administrator.
API information¶
The MLOps Platform uses gRPC (Google Remote Procedure Call) as its internal communication framework. The platform's services are exposed using gRPC Gateway. The services are not accessible directly, but instead the platform follows the API Gateway pattern and uses a gateway service to contact individual services.
API gateway health check¶
The API gateway includes a health check endpoint that is accessible at /healthz
. Navigate to <H2O_MLOps_GATEWAY>/healthz
for the health check.
Installing the Python client¶
Requirements¶
H2O MLOps version >= 0.40.0
is required in order to use the MLOps Python client.
Note
All examples apart from pump_data.py
can be run using Python 3.6 or later. The pump_data.py
example requires Python 3.8.7 or later for the 3.8 branch and 3.9.1 or later for the 3.9 branch due to a combination of issues with Python's asyncio
, aiohttp
and OpenSSL
modules. Other versions may work too, but they won't work reliably.
Downloading the Python client¶
To download the H2O MLOps Python client wheel, see the H2O MLOps downloads page.
Installing the Python client¶
The following steps describe how to install the H2O MLOps Python client.
-
Navigate to the MLOps Python client wheel location and install using pip.
Important
This documentation uses
pip
for Python package installations. Alternatively, to install packages in Python3, usepip3
.$ pip install <PYTHON_CLIENT_WHEEL_FOR_YOUR_VERSION_OF_MLOPS_PLATFORM>
Note
It is recommended that you create a Python virtual environment prior to installing the Python client and other dependencies.
-
Navigate to the Python client wheel location.
-
Create a Python virtual environment:
python<VERSION> -m venv <VIRTUAL-ENVIRONMENT-NAME>
- Activate the created Python virtual environment:
source <VIRTUAL-ENVIRONMENT-NAME>/bin/activate
- Install MLOps Python client using pip:
pip install <PYTHON_CLIENT_WHEEL_FOR_YOUR_VERSION_OF_MLOPS_PLATFORM>
-
-
Download the
requirements.txt
file that is compatible with your Python version in order to install the necessary dependencies: -
Install dependencies from the
requirements.txt
file:$ pip install -r requirements.txt