How to get the Job ID, Run ID & Start Time for a Databricks Job with working code

Canadian Data Guy
2 min readFeb 23, 2023

Table Of Contents:

Step 1: Pass the parameters
Step 2: Get/Fetch and print the values
· Advanced & quicker method to implement
· Footnote

It’s crucial to monitor task parameter variables such as job_id, run_id, and start_time while running ELT jobs. These system-generated values can be saved or printed for future reference. Please refer below to find the comprehensive list of supported parameters.

This is a simple 2-step process:

  1. Pass the parameter when defining the job/task
  2. Get/Fetch and print the values

Step 1: Pass the parameters

Step 2: Get/Fetch and print the values

print(f"""
job_id: {dbutils.widgets.get('job_id')}
run_id: {dbutils.widgets.get('run_id')}
parent_run_id: {dbutils.widgets.get('parent_run_id')}
task_key: {dbutils.widgets.get('task_key')}
""")

--

--

Canadian Data Guy

https://canadiandataguy.com | Data Engineering & Streaming @ Databricks | Ex Amazon/AWS | All Opinions Are My Own