ComeçarComece de graça

Start a cluster

Clusters oftentimes are configured to turn off and run in IDLE mode after being inactive for a certain period of time. We can use the clusters service of the Databricks SDK to run a cluster that exists in the authenticated workspace.

Este exercício faz parte do curso

Databricks with the Python SDK

Ver curso

Instruções do exercício

  • Store value of environment variable DATACAMP_CLUSTER_ID in a variable called cluster_id.
  • Start cluster with id stored in environment variable DATACAMP_CLUSTER_ID.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

w = WorkspaceClient()

# Store value of the environment variable as cluster_id
cluster_id = os.____['DATACAMP_CLUSTER_ID']

# Start cluster with id stored in cluster_id variable
try:
  w.clusters.start(____=cluster_id).result()
except:
  print(f"Cannot start cluster_id={cluster_id} because it is already running")
Editar e executar o código