Skip to main content
Version: Next 🚧

Connect to H2O MLOps

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

  1. Connect with SSL verification enabled
  2. Connect with private certificate
  3. Connect with SSL verification disabled
  4. Connect from H2O Notebook Labs

Prerequisites​

Before you connect to H2O MLOps, make sure you complete the following steps.

  1. Import the necessary Python packages. For instructions, see Step 1: Import the required packages.

  2. Gather required values. You need two values to connect:

    • h2o_cloud_url: The URL used to access the H2O Cloud homepage.
    • refresh_token: Obtain the refresh_token from the H2O Cloud UI. For instructions, see Get the platform token.

The H2O MLOps Python Client also supports the following optional SSL settings:

  • verify_ssl: If set to True (the default value), the client will check that the server's SSL certificate is valid.
  • ssl_cacert: A path to a custom CA (Certificate Authority) certificate or bundle in .pem, or .crt format.

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
  • ssl_cacert: MLOPS_AUTH_CA_FILE_OVERRIDE

You can connect to the H2O MLOps client with SSL verification either enabled or disabled. Use one of the following examples based on your SSL configuration preferences.

Connect with SSL verification enabled​

Connection with SSL verification is a default mode for MLOPs Python Client.

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

Connect with private certificate​

To connect to an environment that uses a private certificate, please follow the following:

mlops = h2o_mlops.Client(
h2o_cloud_url=...,
refresh_token=...,
ssl_cacert="/path/to/your/ca_certificate.pem",
)

Connect with SSL verification disabled​

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

Connect 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.

Input:

mlops = h2o_mlops.Client()

Verify the connection​

After establishing the connection, verify it by checking your user information.

Input:

mlops.users.get_me()

Output:

<class 'h2o_mlops._users.MLOpsUser(
uid='1234-5678-91011',
username='user',
name='User',
email='user@example.com',
)'>

Feedback