Passing values between notebook tasks in Workflow Jobs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ10-30-2022 02:58 AM
I have created a Databricks workflow job with notebooks as individual tasks sequentially linked. I assign a value to a variable in one notebook task (ex: batchid = int(time.time()). Now, I want to pass this batchid variable to next notebook task.
What is the best option to pass this variable to the next notebook? Is using widgets the only option to pass?
- Labels:
-
Notebook Task
-
Workflow Jobs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ12-03-2022 02:35 AM
Hi @Saravanan Ponnaiahโ
Stumbled across this old question so answering just in case.
You can use dbutils.notebook.exit and exit the 1st notebook with that batchid variable. You can then collect this variable in you next linked notebook.
Hope this helps..
Cheers..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ01-08-2023 09:54 PM
Hi @Saravanan Ponnaiahโ
Hope everything is going great.
Does @Uma Maheswara Rao Desulaโ response answer your question? If yes, would you be happy to mark it as best so that other members can find the solution more quickly?
We'd love to hear from you.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ07-09-2023 07:51 PM
@brickster You would use dbutils.jobs.taskValues.set() and dbutils.jobs.taskValues.get().
See docs for more details: https://docs.databricks.com/workflows/jobs/share-task-context.html

