Skip to main content
Version: v0.68.0

Connect to H2O MLOps

This page describes three recommended methods for connecting to H2O MLOps with the Python Client. Select a method based on how your H2O Cloud is set up and where you are connecting from.

Note

To connect to an environment that uses a private certificate, you need to configure the environment variable MLOPS_AUTH_CA_FILE_OVERRIDE. This variable must point to the path of the certificate file that the client should use for secure communication. For example:

export MLOPS_AUTH_CA_FILE_OVERRIDE=/path/to/your/ca_certificate.pem

MLOps is in an H2O Cloud with Discovery Service

From H2O Notebook Labs

H2O Notebook Labs in the H2O Cloud will detect your user and automatically connect to H2O MLOps. For more information on H2O Notebook Labs, see the H2O Notebook Labs documentation.

import h2o_mlops


mlops = h2o_mlops.Client()

From outside of H2O Cloud

To connect to H2O MLOps from outside the H2O Cloud, a h2o_cloud_url and refresh_token are required:

  • h2o_cloud_url: This is the same URL used to access the H2O Cloud homepage.

  • refresh_token: For information on how to retrieve your refresh token (also known as a platform token), see API authentication.

import h2o_mlops


mlops = h2o_mlops.Client(
h2o_cloud_url=h2o_cloud_url,
refresh_token=refresh_token
)

The Python client will also check environment variables and automatically use them if no arguments are supplied:

  • h2o_cloud_url: H2O_CLOUD_ENVIRONMENT

  • refresh_token: H2O_CLOUD_CLIENT_PLATFORM_TOKEN

MLOps is in a H2O Cloud without Discovery Service

To connect to an H2O Cloud from outside the cloud, a gateway_url and token_provider are required.

  • gateway_url: is similar to the URL used to access the H2O Cloud homepage, except mlops-api. is prepended to the host. For example, if the H2O Cloud homepage is at https://cloud.h2o.ai, then the gateway_url is https://mlops-api.cloud.h2o.ai.

  • token_provider: For information on how to create a token_provider using the h2o_authn library, see Authenticate using the h2o-authn package.

import h2o_authn
import h2o_mlops


token_provider = h2o_authn.TokenProvider(
refresh_token=...,
client_id=...,
token_endpoint_url=...
)

mlops = h2o_mlops.Client(
gateway_url=gateway_url,
token_provider=token_provider
)

Feedback