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: 

Workflow - How to find the task id at run time in current notebook

rameshybr
New Contributor II

There are four tasks in the workflow. How can I get the task ID at the beginning of the notebook, store it after finishing all the code cells in the notebook, and then save it into a table?

3 REPLIES 3

szymon_dybczak
Esteemed Contributor III

Hi @rameshybr ,

You can use dynamic value references, specifically 

{{task.run_id}}

The unique identifier of the current task run.

Pass context about job runs into job tasks | Databricks on AWS

rameshybr
New Contributor II

How to use in note book cell ?

can you please describe in details pls.

menotron
Valued Contributor

Hi @rameshybr,

You can capture these as parameters in the task configuration.menotron_1-1723960911058.png

And from within the notebook you could use the widget utils to get their values.menotron_2-1723961287481.png