Clusters#
For usage information and examples, see Clusters
- class dataikuapi.dss.admin.DSSCluster(client, cluster_id)#
A handle to interact with a cluster on the DSS instance.
Important
Do not instantiate directly, use
dataikuapi.DSSClient.get_cluster()
instead.- delete()#
Deletes the cluster.
Important
This does not previously stop it.
- get_settings()#
Get the cluster’s settings. This includes opaque data for the cluster if this is a started managed cluster.
The returned object can be used to save settings.
- Returns:
a
DSSClusterSettings
object to interact with cluster settings- Return type:
- get_definition()#
Get the cluster’s definition. This includes opaque data for the cluster if this is a started managed cluster.
Caution
Deprecated, use
get_settings()
- Returns:
the definition of the cluster as a dict. For clusters from plugin components, the settings of the cluster are in a params field.
- Return type:
dict
- set_definition(cluster)#
Set the cluster’s definition. The definition should come from a call to the get_definition() method.
Caution
Deprecated, use
DSSClusterSettings.save()
Important
You should only
set_definition()
using an object that you obtained throughget_definition()
, not create a new dict.- Parameters:
cluster (dict) – a cluster definition
- Returns:
the updated cluster definition
- Return type:
dict
- get_status()#
Get the cluster’s status and usage
- Returns:
The cluster status, as a
DSSClusterStatus
object- Return type:
- start()#
Starts or attaches the cluster
Caution
This operation is only valid for a managed cluster.
- stop(terminate=True, force_stop=False)#
Stops or detaches the cluster
This operation is only valid for a managed cluster.
- Parameters:
terminate (boolean) – whether to delete the cluster after stopping it
force_stop (boolean) – whether to try to force stop the cluster, useful if DSS expects the cluster to already be stopped
- run_kubectl(args)#
Runs an arbitrary kubectl command on the cluster.
Caution
This operation is only valid for a Kubernetes cluster.
Note
This call requires an API key with DSS instance admin rights
- Parameters:
args (string) – the arguments to pass to kubectl (without the “kubectl”)
- Returns:
a dict containing the return value, standard output, and standard error of the command
- Return type:
dict
- delete_finished_jobs(delete_failed=False, namespace=None, label_filter=None, dry_run=False)#
Runs a kubectl command to delete finished jobs.
Caution
This operation is only valid for a Kubernetes cluster.
- Parameters:
delete_failed (boolean) – if True, delete both completed and failed jobs, otherwise only delete completed jobs
namespace (string) – the namespace in which to delete the jobs, if None, uses the namespace set in kubectl’s current context
label_filter (string) – delete only jobs matching a label filter
dry_run (boolean) – if True, execute the command as a “dry run”
- Returns:
a dict containing whether the deletion succeeded, a list of deleted job names, and debug info for the underlying kubectl command
- Return type:
dict
- delete_finished_pods(namespace=None, label_filter=None, dry_run=False)#
Runs a kubectl command to delete finished (succeeded and failed) pods.
Caution
This operation is only valid for a Kubernetes cluster.
- Parameters:
namespace (string) – the namespace in which to delete the pods, if None, uses the namespace set in kubectl’s current context
label_filter (string) – delete only pods matching a label filter
dry_run (boolean) – if True, execute the command as a “dry run”
- Returns:
a dict containing whether the deletion succeeded, a list of deleted pod names, and debug info for the underlying kubectl command
- Return type:
dict
- delete_all_pods(namespace=None, label_filter=None, dry_run=False)#
Runs a kubectl command to delete all pods.
Caution
This operation is only valid for a Kubernetes cluster.
- Parameters:
namespace (string) – the namespace in which to delete the pods, if None, uses the namespace set in kubectl’s current context
label_filter (string) – delete only pods matching a label filter
dry_run (boolean) – if True, execute the command as a “dry run”
- Returns:
a dict containing whether the deletion succeeded, a list of deleted pod names, and debug info for the underlying kubectl command
- Return type:
dict
- class dataikuapi.dss.admin.DSSClusterSettings(client, cluster_id, settings)#
The settings of a cluster.
Important
Do not instantiate directly, use
DSSCluster.get_settings()
instead.- get_raw()#
Gets all settings as a raw dictionary.
Changes made to the returned object will be reflected when saving.
Fields that can be updated:
permissions, usableByAll, owner
params
- Returns:
reference to the raw settings, not a copy. See
DSSCluster.get_definition()
- Return type:
dict
- get_plugin_data()#
Get the opaque data returned by the cluster’s start.
Caution
You should generally not modify this
- Returns:
the data stored by the plugin in the cluster, None if the cluster is not created by a plugin
- Return type:
dict
- save()#
Saves back the settings to the cluster
- class dataikuapi.dss.admin.DSSClusterStatus(client, cluster_id, status)#
The status of a cluster.
Important
Do not instantiate directly, use
DSSCluster.get_status()
instead.- get_raw()#
Gets the whole status as a raw dictionary.
- Returns:
status information, as a dict. The current state of the cluster is in a state field, with ossible values: NONE, STARTING, RUNNING, STOPPING
- Return type:
dict