Skip to main content

DAI Setup

DAI Setup is a configuration resource for all DAI Engines.

Advanced users and app developers

See the module documentation for full client reference.

Applying DAI Setup

You can apply a target state of DAI 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 Driverless AI setup.
client = h2o_engine_manager.login().dai_setup_client.default_dai_setup_client

# Fetch the current state of the DAI Setup.
s = client.get_default_dai_setup()

# Prepare all updated fields.
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.storage_bytes_constraint = NumericConstraint(
minimum="3Gi",
default="6Gi",
maximum="9Gi",
)
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.max_non_interaction_duration = "2d"
s.max_unused_duration = "1d"
s.configuration_override = {
"a": "b",
"c": "my-new-d",
}
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()
s.triton_enabled = False

# Apply updates
client.update_default_dai_setup(default_dai_setup=s)

Feedback