cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the Job ID and Run ID and save into a database

Mohit_m
Valued Contributor II

We are having Databricks Job running with main class and JAR file in it. Our JAR file code base is in Scala. Now, when our job starts running, we need to log Job ID and Run ID into the database for future purpose. How can we achieve this?

1 ACCEPTED SOLUTION

Accepted Solutions

Mohit_m
Valued Contributor II

You can pass {job_id}} and {{run_id}} in Job arguments and print that information and save into wherever its needed

please find below the documentation for the same

https://docs.databricks.com/data-engineering/jobs/jobs.html#task-parameter-variables

{{job_id}}

The unique identifier assigned to a job

1276862

{{run_id}}

The unique identifier assigned to a job run

3447843

{{parent_run_id}}

The unique identifier assigned to the run of a job with multiple tasks.

3447835

{{task_key}}

The unique name assigned to a task that’s part of a job with multiple tasks.

View solution in original post

3 REPLIES 3

Mohit_m
Valued Contributor II

You can pass {job_id}} and {{run_id}} in Job arguments and print that information and save into wherever its needed

please find below the documentation for the same

https://docs.databricks.com/data-engineering/jobs/jobs.html#task-parameter-variables

{{job_id}}

The unique identifier assigned to a job

1276862

{{run_id}}

The unique identifier assigned to a job run

3447843

{{parent_run_id}}

The unique identifier assigned to the run of a job with multiple tasks.

3447835

{{task_key}}

The unique name assigned to a task that’s part of a job with multiple tasks.

User16783853961
New Contributor II

Bruno-Castro
New Contributor II

That article is for members only, can we also specify here how to do it (for those that are not medium members?). Thanks!

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!