Skip to main content

Launch Driverless AI

A composite action that creates a Driverless AI engine through AI Engine Manager, blocks until it reaches STATE_RUNNING, and returns the engine's API URL as an output — later steps in the calling job can connect to it directly. Authentication is handled via the auto-injected H2O_CLOUD_CLIENT_PLATFORM_TOKEN so there is no need to pass credentials (the runner already has them).

Because the action runs inline, it also leaves the h2o-engine-manager client installed in the job, so later steps can import it to talk to the engine.

Every input except engine_id is optional: leave them empty and the engine inherits the default values from the selected profile.

Action

id: launch-dai
name: Launch Driverless AI Instance

inputs:
engine_id:
type: string
required: true
description: "Engine ID — used to connect to the engine from subsequent steps"

display_name:
type: string
required: false
default: ""
description: "Human-readable engine name"

cpu:
type: string
required: false
default: ""
description: "CPU units (default from profile)"

gpu:
type: string
required: false
default: ""
description: "GPU units (default from profile)"

memory:
type: string
required: false
default: ""
description: "Memory allocation, e.g. 32Gi (default from profile)"

storage:
type: string
required: false
default: ""
description: "Storage allocation, e.g. 64Gi (default from profile)"

max_idle_duration:
type: string
required: false
default: ""
description: "Auto-pause after idle, e.g. 30m, 2h (default from profile)"

max_running_duration:
type: string
required: false
default: ""
description: "Max running time, e.g. 12h, 2d (default from profile)"

version:
type: string
required: false
default: ""
description: "DAI version resource name, e.g. workspaces/global/daiEngineVersions/1.11.23 (default: latest)"

profile:
type: string
required: false
default: ""
description: "DAI profile resource name, e.g. workspaces/global/daiEngineProfiles/default (default: first available)"

outputs:
engine_url:
description: "API URL of the ready engine"
value: ${{ .steps.launch.outputs.engine_url }}

steps:
- name: Install AIEM client
run: sudo uv pip install --system h2o-engine-manager

- id: launch
name: Launch DAI engine
timeout: "30m"
env:
ENGINE_ID: ${{ .inputs.engine_id }}
DISPLAY_NAME: ${{ .inputs.display_name }}
CPU: ${{ .inputs.cpu }}
GPU: ${{ .inputs.gpu }}
MEMORY: ${{ .inputs.memory }}
STORAGE: ${{ .inputs.storage }}
MAX_IDLE: ${{ .inputs.max_idle_duration }}
MAX_RUNNING: ${{ .inputs.max_running_duration }}
VERSION: ${{ .inputs.version }}
PROFILE: ${{ .inputs.profile }}
run: |
python3 -c "
import os
import h2o_engine_manager

clients = h2o_engine_manager.login(
platform_token=os.environ['H2O_CLOUD_CLIENT_PLATFORM_TOKEN'],
)

kwargs = {'engine_id': os.environ['ENGINE_ID']}
if os.environ.get('DISPLAY_NAME'):
kwargs['display_name'] = os.environ['DISPLAY_NAME']
if os.environ.get('CPU'):
kwargs['cpu'] = int(os.environ['CPU'])
if os.environ.get('GPU'):
kwargs['gpu'] = int(os.environ['GPU'])
if os.environ.get('MEMORY'):
kwargs['memory_bytes'] = os.environ['MEMORY']
if os.environ.get('STORAGE'):
kwargs['storage_bytes'] = os.environ['STORAGE']
if os.environ.get('MAX_IDLE'):
kwargs['max_idle_duration'] = os.environ['MAX_IDLE']
if os.environ.get('MAX_RUNNING'):
kwargs['max_running_duration'] = os.environ['MAX_RUNNING']
if os.environ.get('VERSION'):
kwargs['dai_engine_version'] = os.environ['VERSION']
if os.environ.get('PROFILE'):
kwargs['profile'] = os.environ['PROFILE']

engine = clients.dai_engine_client.create_engine(**kwargs)
print(f'Engine created: {engine.engine_id}')
print(f'State: {engine.state.value}')

print('Waiting for engine to become ready...')
engine.wait()

print(f'Engine is ready: {engine.state.value}')
print(f'Engine URL: {engine.api_url}')

with open(os.environ['H2O_WORKFLOWS_OUTPUT'], 'a') as f:
f.write(f'engine_url={engine.api_url}\n')
"

Publish the action to make it callable from workflows.

Use it from your workflow

Give the uses step an id to read the engine URL in later steps of the same job:

id: train-with-dai
name: Train with Driverless AI

jobs:
train:
timeout: "1h" # must cover the engine launch wait (up to 30m)
steps:
- uses: <workspace-id>:launch-dai@latest
id: dai
with:
engine_id: "my-dai-engine"

- name: Use the engine
env:
DAI_URL: ${{ .steps.dai.outputs.engine_url }}
run: echo "DAI is ready at $DAI_URL"

Add display_name, cpu, gpu, memory, and other optional inputs listed above as needed to override profile defaults.


Feedback