Skip to main content

H2O Setup

H2O Setup is a configuration resource for all H2O Engines.

Advanced users and app developers

See the module documentation for full client reference.

Applying H2O Setup

You can apply a target state of H2O Setup using the example below.

import os
import h2o_engine_manager

from h2o_engine_manager.clients.constraint.duration_constraint import DurationConstraint
from h2o_engine_manager.clients.constraint.numeric_constraint import NumericConstraint

# Initialize the client for H2O setup.
client = h2o_engine_manager.login().h2o_setup_client.default_h2o_setup_client

# Fetch the current state of the H2O Setup.
s = client.get_default_h2o_setup()

# Prepare all updated fields.
s.node_count_constraint = NumericConstraint(
minimum="1",
default="1",
maximum="4",
)
s.cpu_constraint = NumericConstraint(
minimum="2",
default="3",
maximum="4"
)
s.gpu_constraint = NumericConstraint(
minimum="3",
default="4",
maximum="5"
)
s.memory_bytes_constraint = NumericConstraint(
minimum="2Gi",
default="4Gi",
maximum="6Gi"
)
s.max_idle_duration_constraint = DurationConstraint(
minimum="1m",
default="2h",
maximum="20h",
)
s.max_running_duration_constraint = DurationConstraint(
minimum="2m",
default="2h",
maximum="20h"
)
s.yaml_pod_template_spec = open(
os.path.join(os.path.dirname(__file__), "pod_template_spec.yaml"), "r"
).read()
s.yaml_gpu_tolerations = open(
os.path.join(os.path.dirname(__file__), "gpu_tolerations.yaml"), "r"
).read()

# Apply updates
client.update_default_h2o_setup(default_h2o_setup=s)

Feedback