Admin API¶
This page describes the admin API, which lets you manage administrative operations in the Driverless AI Python client.
Initialize a client with your server credentials and store them in the variable client
.
import driverlessai
client = driverlessai.Client(address='http://localhost:12345', username="py", password="py")
You can check whether the connected user has admin privileges as follows.
client.admin.is_admin
True
Loading all users¶
You can list all the users of Driverless AI as follows.
client.admin.list_users()
['alice', 'bob', 'charlie']
Loading all currently logged in users¶
All of the logged in users of a Driverless AI server can be listed as follows. Note that this functionality is only supported for Driverless AI server version 1.10.5 and later.
client.admin.list_current_users()
['alice', 'bob']
List the datasets of a specified user¶
You can list the datasets created by a specific user as follows.
datasets = client.admin.list_datasets(username="alice")
This returns a list of objects of DatasetProxy
and it has the following properties.
dataset = datasets[0]
print("Dataset key : " , dataset.key)
print("Dataset name : " , dataset.name)
print("Dataset owner : " , dataset.owner)
Dataset key : 02fdc4d4-cc7d-11ed-ae20-ac1f6b6b4a0e Dataset name : retail-data.csv Dataset owner : alice
You can also delete a dataset as follows.
dataset.delete()
List the experiments of a specified user¶
You can list all the experiments created by a specific user as follows.
experiments = client.admin.list_experiments(username="alice")
This returns a list of objects of ExperimentProxy
and it provides the following methods.
experiment = experiments[0]
print("Completed : " , experiment.is_complete())
print("Running : " , experiment.is_running())
print("Experiment status : " , experiment.status(verbose=1))
Completed : True Running : False Experiment status : Complete 100.00%
Transfer data between users¶
Here, all the data, including datasets and experiments, is transferred to the other user.
client.admin.transfer_data(from_user="alice", to_user="bob")
You can now view the datasets created by Alice
under Bob
's datasets.
client.admin.list_datasets(username="bob")
[<driverlessai._admin.DatasetProxy at 0x12ac98190>, <driverlessai._admin.DatasetProxy at 0x12ac989a0>]