CommencerCommencer gratuitement

Listing Databricks clusters

Databricks clusters are a set of virtual computers hosted in the Databricks platform that allow you to run Databricks jobs and notebooks. Similar to the jobs API, the clusters API of the WorkspaceClient exposes a .list() function that lists all clusters in the authenticated workspace.

Cet exercice fait partie du cours

Databricks with the Python SDK

Afficher le cours

Instructions

  • Iterate through all clusters.
  • Print the cluster name.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

# Iterate through all clusters
for c in w.____.____():
  # Print cluster id for each cluster
  print(c.____)
Modifier et exécuter le code