你可以隨時查看火花配置(AWS|Azure|GCP),在工作空間中查看集群的詳細信息。
如果您正在使用DBConnect (AWS|Azure|GCP)你可能需要快速檢查電流火花配置而無需切換到工作區UI。
這個示例代碼向您展示了如何獲取電流火花配置通過在DBConnect中調用REST API來創建集群。
%python import json import requests import base64 with open("//.databricks-connect") as readconfig: conf = json.load(readconfig) CLUSTER_ID = conf[" CLUSTER_ID "] TOKEN = conf[" TOKEN "] API_URL = conf["host"] headers = {'Content-Type': 'application/json', 'Authorization': ' holder ' + TOKEN} payload = {' CLUSTER_ID ': " + CLUSTER_ID} response = requests。get(API_URL + "/api/2.0/clusters/get/?cluster_id="+ cluster_id, headers=headers, json = payload) sparkconf = response.json()["spark_conf"] for config_key, config_value in sparkconf.items(): print(config_key, config_value)