簡體   English   中英

如何獲取 Azure Databricks 筆記本運行詳細信息

[英]How to fetch Azure Databricks notebook run details

我正在使用 Azure 數據工廠運行我的 databricks notebook,它在運行時創建作業集群,現在我想知道這些作業的狀態,我的意思是它們是成功還是失敗。 所以我可以知道,我怎樣才能通過使用作業 ID 或運行 ID 獲得運行狀態。

注意:我沒有在我的 databricks 工作區中創建任何作業,我正在使用 Azure 數據工廠運行我的筆記本,它在運行時創建了作業集群,它在該集群之上運行該筆記本,然后終止該集群

import json
import requests

gethooks= "https://" + databricks_instance_name + "/api/2.0/jobs/runs/list"     #add your databricks workspace instance name over here
headers={"Authorization": "Bearer ********************"}        # Add your databricks access token
response = requests.get(gethooks, headers=headers)

print(response.json())      # you will get all cluster and job related info over here in json format

# traversing through response.json
for element in response.json()['runs']:
    job_id = element['job_id']
    status = element['state']['result_state']
    job_path = element['task']['notebook_task']['notebook_path']
    job_name = job_path.split('/')

您必須轉到 Azure 數據工廠中的監控頁面。 您可以在此處按 runId 進行過濾。

https://docs.microsoft.com/en-us/azure/data-factory/transform-data-using-databricks-notebook#monitor-the-pipeline-run

https://forums.databricks.com/questions/12134/possible-to-get-job-run-id-of-notebook-run-by-dbut.html

dbutils.notebook.entry_point.getDbutils().notebook().getContext().toJson() 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM