Skip to main content

Manage an IDE Engine

This guide covers opening and managing an IDE Engine with the Python client. The examples assume this setup:

import h2o_engine_manager

aiem = h2o_engine_manager.login()
ide_engine_client = aiem.ide_engine_client
name = "workspaces/<workspace-id>/ideEngines/my-ide"

Open an IDE Engine​

Get the engine's URL with access_ide_engine and open it in your browser:

access = ide_engine_client.access_ide_engine(name=name)
print(access.uri)

The URL has the form https://<platform host>/workspaces/<workspace-id>/ideEngines/<engine-id>/ and works while the engine is running.

The editor doesn't ask for a password yet

The engine serves the editor to anyone who can reach the platform gateway and knows its URL. This includes its terminal, its files, and the platform token AI Engine Manager provides for you. access_ide_engine also returns a password, but the current image ignores it. Treat the URL as a secret, and use IDE Engines in development environments only until authentication returns.

Only the engine's creator can call access_ide_engine; other users in the workspace get a permission error. They can still see the engine in lists.

List IDE Engines​

for engine in ide_engine_client.list_all_ide_engines(parent="workspaces/<workspace-id>"):
print(engine.name, engine.state)

Pause and resume​

Pausing stops the engine and keeps its home directory. Running processes and open terminals end.

ide_engine_client.pause_ide_engine(name=name)
ide_engine_client.wait(name=name) # until PAUSED

ide_engine_client.resume_ide_engine(name=name)
ide_engine_client.wait(name=name, timeout_seconds=600) # until RUNNING

When the engine resumes, AI Engine Manager checks its settings against its profile as the profile is now and starts it with the current profile and image configuration. Resuming fails with a validation error if an administrator has since lowered a limit below the engine's setting; edit the engine to fit and resume again.

Edit an IDE Engine​

You can edit a paused or failed engine. The changes take effect the next time it resumes.

engine = ide_engine_client.get_ide_engine(name=name)
engine.cpu = 4
engine.memory_bytes = "16Gi"
engine.max_idle_duration = "4h"

engine = ide_engine_client.update_ide_engine(ide_engine=engine)

By default, update_ide_engine updates all editable fields: display_name, profile, cpu, gpu, memory_bytes, max_idle_duration, and max_running_duration. To change only some of them, pass update_mask, for example update_mask="cpu,memory_bytes". The values are checked against the profile the engine will have after the update.

The image and the storage size can't be changed with update_ide_engine. To grow the storage, resize it.

Resize the storage​

You can grow the engine's home directory while the engine is running or paused:

engine = ide_engine_client.resize_ide_engine_storage(name=name, new_storage="50Gi")
print(engine.storage_resizing)
Resize considerations
  • Storage can only grow, within the profile's maximum.
  • storage_resizing is True until the volume has been resized. Depending on the storage class, this can take a while.
  • The storage class must support volume expansion.

Delete an IDE Engine​

Deleting an engine permanently removes it and its home directory. This can't be undone.

ide_engine_client.delete_ide_engine(name=name)
ide_engine_client.wait(name=name) # returns None once the engine is gone
Permanent deletion

Copy any files you want to keep out of the engine, for example by pushing them to a Git repository, before you delete it.

Engine states​

StateMeaning
STATE_STARTINGThe engine is starting
STATE_RUNNINGThe editor is ready at the engine's URL
STATE_PAUSINGThe engine is pausing
STATE_PAUSEDThe engine is stopped; its home directory is kept
STATE_FAILEDThe engine stopped unexpectedly. Edit it if needed and resume it
STATE_DELETINGThe engine is being deleted
STATE_TERMINATEDThe engine's storage was lost; it can't be resumed and can only be deleted

wait returns as soon as the engine leaves STARTING, PAUSING, or DELETING.


Feedback