Clusters#

The API offers methods to:

  • Start, stop or delete clusters

  • Read and write settings of clusters

  • Get the status of clusters

Clusters may be listed, created and obtained using methods of the DSSClient:

  • list clusters: list_clusters()

  • obtain a handle on a cluster: get_cluster()

  • create a cluster: create_cluster()

DSSClusterSettings is an opaque type and its content is specific to each cluster provider. It is therefore strongly advised to use scenario steps to create/start/delete clusters, as this will greatly help define a consistent configuration.

Starting a managed cluster#

import logging
logger = logging.getLogger("my.package")

client = dataiku.api_client()

cluster_id = "my_cluster_id"

# Obtain a handle on the cluster
my_cluster = client.get_cluster(cluster_id)

# Start the cluster. This operation is synchronous. An exception is thrown in case of error
try:
    my_cluster.start()
    logger.info("Cluster {} started".format(cluster_id))
except:
    logger.exception("Could not start cluster: {}".format(e))

Getting the status of a cluster#

import logging
logger = logging.getLogger("my.package")

client = dataiku.api_client()

cluster_id = "my_cluster_id"

# Obtain a handle on the cluster
my_cluster = client.get_cluster(cluster_id)

# Get status
status = my_cluster.get_status()

logger.info("Cluster status is {}".format(status))

Reference documentation#

dataikuapi.dss.admin.DSSCluster(client, ...)

A handle to interact with a cluster on the DSS instance.

dataikuapi.dss.admin.DSSClusterSettings(...)

The settings of a cluster.

dataikuapi.dss.admin.DSSClusterStatus(...)

The status of a cluster.