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

rameshybr
Databricks Partner

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?

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
Databricks Partner

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