How to get the Job ID, Run ID & Start Time for a Databricks Job with working code
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:
- Pass the parameter when defining the job/task
- 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')}
""")