DAI Profiles
DAI Profiles are used as presets to specify the resources available to DAI engines. The end-user can select a profile when creating a DAI engine.
Advanced users and app developers
See the module documentation for full client reference.
Applying DAI Profiles
You can apply a target state of all DAIProfiles via configuration. No need to manually Create, Update or Delete all DAI Profiles. All existing DAI Profiles not specified in the input configuration will be deleted!
import h2o_engine_manager
from h2o_engine_manager.clients.dai_profile.profile_config import DAIProfileConfig
# Initialize the client for Driverless AI profiles.
client = h2o_engine_manager.login().dai_profile_client
configs = [
DAIProfileConfig(
dai_profile_id="small",
display_name="Small",
cpu=1,
gpu=0,
memory_bytes="1Gi",
storage_bytes="1Gi",
),
DAIProfileConfig(
dai_profile_id="medium",
display_name="Medium",
cpu=2,
gpu=0,
memory_bytes="2Gi",
storage_bytes="2Gi",
),
DAIProfileConfig(
dai_profile_id="large",
display_name="Large",
cpu=3,
gpu=0,
memory_bytes="3Gi",
storage_bytes="3Gi",
)
]
# DAIProfiles will be in specified order: small, medium, large.
# All other profiles not specified in the configs will be deleted.
client.apply_dai_profiles(dai_profile_configs=configs)
Creating a profile
# Create a new profile.
profile = client.create_profile(
profile_id="test-profile",
cpu=8,
gpu=0,
memory_bytes="8Gi",
storage_bytes="16Gi",
display_name="Test Profile",
)
Getting a profile
profile = client.get_profile(profile_id="test-profile")
Listing profiles
# Listing supports pagination.
# Returned object contains `profiles`, `total_size` and `next_page_token` fields.
page = client.list_profiles(page_size=1)
# {'next_page_token': '7f78da95473b2508561551b4f45fbdabb8352f94e1bdacae638990b83986b7f4',
# 'profiles': [{'cpu': 1,
# 'display_name': 'my best profile',
# 'gpu': 3,
# 'memory_bytes': '3Gi',
# 'name': 'daiProfiles/profile1',
# 'storage_bytes': '3Gi'}],
# 'total_size': 4}
# Get the next page.
second_page = client.list_profiles(page_size=1, page_token=page.next_page_token)
# You can use simplified function to list all available profiles
all_profiles = client.list_all_profiles()
Updating a profile
profile = client.get_profile(profile_id="test-profile")
# Modify profile fields you wish to update.
profile.cpu = 4
profile.gpu = 2
profile.memory_bytes = "4Gi"
profile.storage_bytes = "8Gi"
profile.display_name = "Even bigger test profile"
# To update a profile, use `update_profile` function.
# The `update_mask` parameter is optional and can be used to specify which fields should be updated.
# If not specified, all fields will be updated.
client.update_profile(
profile=profile,
)
Deleting a profile
# To delete a profile, use `delete_profile` function.
client.delete_profile(profile_id="my-profile")
Feedback
- Submit and view feedback for this page
- Send feedback about AI Engine Manager to cloud-feedback@h2o.ai