- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 05:23 AM
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?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 05:25 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 05:25 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2023 11:16 AM
Here is a blog with code and examples on how to achieve this https://medium.com/@canadiandataguy/how-to-get-the-job-id-and-run-id-for-a-databricks-job-b0da484e66...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 01:05 AM
That article is for members only, can we also specify here how to do it (for those that are not medium members?). Thanks!

