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.
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, exceptmlops-api.
is prepended to the host. For example, if the H2O Cloud homepage is athttps://cloud.h2o.ai
, then thegateway_url
ishttps://mlops-api.cloud.h2o.ai
.token_provider
: For information on how to create atoken_provider
using theh2o_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
)
- Submit and view feedback for this page
- Send feedback about H2O MLOps to cloud-feedback@h2o.ai