Python Client Admin API

The following sections describe Driverless AI’s Admin API.

Note

The Admin API is currently only available through the DAI Python client.

Understanding the Admin API

The Driverless AI Admin API lets you manage entities created by other users by providing options for listing, deleting, or transferring them. The primary component of the Admin API is the new user role called Admin. Driverless AI currently supports only local Admin user authorization, which is defined through the local_administrator_list config parameter. For example, to promote UserA and UserB to administrator, add the following config override to the config.toml file:

local_administrator_list = ['UserA', 'UserB']

Admin API methods

The following is a list of DAI Admin API methods.

Note

The following examples assume that you have initialized the h2oai Python client and are logged in with a user that has the Admin role.

Listing entities

To list the datasets of a particular user, use the following client method:

# cli = h2oai_client.Client(...)
cli.admin.list_entities(
    username="other-user-name",
    kind="dataset",
)

The following is a list of entities that can be listed with the preceding method:

  • model: Experiments

  • dataset: Datasets

  • project: Projects

  • deployment: Deployments

  • interpretation: MLI interpretations

  • model_diagnostic: Model diagnostics

Deleting entities

If you know the kind and key associated with an entity, you can delete that entity with the following client method:

# cli = h2oai_client.Client(...)
cli.admin.delete_entity(
    username="other-user-name",
    kind="model",
    key="model-key",
)

Note

An entity’s kind and key can be obtained through the listing API.

Transferring entities

To transfer all of a user’s entities and files to a new user, use the following client method:

# cli = h2oai_client.Client(...)
cli.admin.transfer_entities(
    username_from="original-user-name",
    username_to="new-user-name",
)

Note

The new user specified in this method can be either an existing user or a user that does not yet exist.