你可以隨時查看火花配置(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. conf = "/ /.databricks-connect")(API_URL +”/ api / 2.0 /集群/ / ?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)