Skip to main content

Module clients.dai_engine.dai_engine

Functions

from_dai_engine_api_object

def from_dai_engine_api_object(client_info: h2o_engine_manager.clients.dai_engine.client_info.ClientInfo, api_engine: h2o_engine_manager.gen.model.v1_dai_engine.V1DAIEngine) ‑> DAIEngine

Classes

DAIEngine

class DAIEngine(version: str, cpu: int, gpu: int, memory_bytes: str, storage_bytes: str, config: Dict[str, str], annotations: Dict[str, str], max_idle_duration: str, max_running_duration: str, display_name: str, name: str = '', state: h2o_engine_manager.clients.dai_engine.dai_engine_state.DAIEngineState = DAIEngineState.STATE_UNSPECIFIED, creator: str = '', creator_display_name: str = '', create_time: datetime.datetime = datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), update_time: Optional[datetime.datetime] = None, delete_time: Optional[datetime.datetime] = None, resume_time: Optional[datetime.datetime] = None, login_url: str = '', api_url: str = '', reconciling: bool = False, uid: str = '', upgrade_available: bool = False, client_info: Optional[h2o_engine_manager.clients.dai_engine.client_info.ClientInfo] = None, current_running_duration: Optional[str] = None, current_idle_duration: Optional[str] = None, storage_resizing: bool = False, total_disk_size_bytes: Optional[str] = None, free_disk_size_bytes: Optional[str] = None)

Methods

connect

def connect(self, verify: Union[bool, str] = True, backend_version_override: Optional[str] = None) ‑> driverlessai._core.Client

Connect to and interact with a Driverless AI server.

Args
verify : Union[bool, str], optional
when using https on the Driverless AI server, setting this to False will disable SSL certificates verification. A path to cert(s) can also be passed to verify, see:https://requests.readthedocs.io/en/master/user/advanced/#ssl-cert-verification. Defaults to True.
backend_version_override : Optional[str], optional
version of client backend to use, overrides Driverless AI server version detection. Specify "latest" to get the most recent backend supported. In most cases the user should rely on Driverless AI server version detection and leave this as the default. Defaults to None.

delete

def delete(self, allow_missing: bool = False, validate_only: bool = False)

Initiates deletion of the engine from its workspace. Once the engine is deleted, any further action with the engine will result in an error.

Args
allow_missing : bool, optional
When set to True and the DAIEngine

is not found, then the request will succeed but no changes are made. validate_only(bool, optional): When set to True, request is validated but no changes are made.

download_logs

def download_logs(self) ‑> str

Download Driverless AI logs.

Returns

Driverless AI logs

migrate_creator

def migrate_creator(self, new_creator: str)

Migrate creator of this DAIEngine. Admin only.

Args
new_creator : str
name of an entity that becomes the new creator of the DAIEngine.
Examples

engine.migrate_creator(new_creator="users/397b8c16-f4cb-41dd-a5e9-5e838edb81ab")

pause

def pause(self)

Pauses the engine and updates its data from the server response.

resize_storage

def resize_storage(self, new_storage: str)

Resize the storage of the DAIEngine.

Args
new_storage : str
new storage size in bytes.
Examples

engine.resize_storage(new_storage="100Gi")

resume

def resume(self)

Resumes the engine and updates its data from the server response.

to_api_object

def to_api_object(self) ‑> h2o_engine_manager.gen.model.v1_dai_engine.V1DAIEngine

to_dai_engine_resource

def to_dai_engine_resource(self) ‑> h2o_engine_manager.gen.model.dai_engine_resource.DAIEngineResource

update

def update(self, update_mask: str = '*', allow_missing: bool = False, validate_only: bool = False)

Updates the engine.

Args
update_mask : str, optional

Comma separated paths referencing which fields to update. Update mask must be non-empty.

Allowed field paths are: max_running_duration. Paths are case sensitive (must match exactly). Example - update only cpu: update_mask="cpu" Example - update only cpu and gpu: update_mask="cpu,gpu"

To update all allowed fields, specify exactly one path with value "*", this is a default value.

allow_missing : bool, optional
When set and the DAIEngine is not found, a new one is created. In this situation, update_mask is ignored, i.e. all fields are applied regardless of any provided update mask; but the update mask must be still present. Defaults to False.
validate_only : bool, optional
When set, request is validated but no changes are made. Defaults to False.

upgrade_version

def upgrade_version(self, new_version: str)

Upgrade DAIEngine version.

Args
new_version : str
name of the new version. Must be greater than the current version.
Examples

engine.upgrade_version(new_version="1.10.3")

wait

def wait(self, timeout_seconds: Optional[float] = None)

Waits for the engine to reach a final (stable) state. Final states are RUNNING or PAUSED. Function updates an engine every 5 seconds and checks its internal state. While waiting for the next update, function calls time.sleep().

Args
timeout_seconds : float, optional
Time limit in seconds for how

long to wait. If no timeout is specified, function will be blocking until the waiting is finished. Potentially forever in case of an unexpected error. Defaults to None.

wait_async

async def wait_async(self, timeout_seconds: Optional[float] = None)

Waits for an engine to reach a final (stable) state. Final states are RUNNING or PAUSED. Function updates an engine every 5 seconds and checks its internal state. While waiting for the next update, function calls asyncio.sleep().

Args
timeout_seconds : float, optional
Time limit in seconds for how

long to wait. If no timeout is specified, function will be blocking until the waiting is finished. Potentially forever in case of an unexpected error. Defaults to None.


Feedback