Administration#
Here are some more global administration tasks that can be performed using the DSS Public API:
Reading and writing general instance settings
Managing user and group impersonation rules for User Isolation Framework
Managing (creating/modifying) code environments
Managing instance variables
Listing long-running tasks, getting their status, aborting them
Listing running notebooks, getting their status, unloading them
Managing global API keys
Listing global DSS usages (projects, datasets, recipes, scenarios…)
Managing personal API keys
Detailed examples#
This section contains more advanced examples on administration tasks.
List running Jupyter notebooks#
You can use dataikuapi.dss.project.DSSProject.list_jupyter_notebooks()
to retrieve a list of notebooks for a given Project, along with useful metadata.
import pprint
import dataiku
def get_instance_notebooks(client):
all_notebooks = dict()
for p in client.list_projects():
p_key = p["projectKey"]
project = client.get_project(p_key)
project_notebooks = project.list_jupyter_notebooks()
if project_notebooks:
notebooks = []
for nb in project_notebooks:
# If the notebook is active then it has at least 1 running session
sessions = nb.get_sessions()
if sessions:
status = "ACTIVE - {} session(s)".format(len(sessions))
else:
status = "INACTIVE"
notebooks.append({"name": nb.notebook_name,
"status": status})
all_notebooks[p_key] = notebooks
return all_notebooks
def pprint_instance_notebooks(client):
all_notebooks = get_instance_notebooks(client)
pprint.pprint(all_notebooks)
client = dataiku.api_client()
pprint_instance_notebooks(client)
Reference documentation#
The general settings of the DSS instance. |
|
An user-level rule items for the impersonation settings |
|
A group-level rule items for the impersonation settings |
|
Dict containing the instance variables. |
|
|
A future represents a long-running task on a DSS instance. |
A handle on a Python/R/scala notebook. |
|
|
An item in a list of Jupyter notebooks. |
Metadata associated to the session of a Jupyter Notebook. |
|
The content of a Jupyter Notebook. |
|
|
A Python/R/Scala notebook on the DSS instance. |
|
A global API key on the DSS instance |
An item in a list of global API keys. |
|
A personal API key on the DSS instance. |
|
An item in a list of personal API key. |