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:ย 

Passing values between notebook tasks in Workflow Jobs

brickster
New Contributor II

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?

3 REPLIES 3

UmaMahesh1
Honored Contributor III

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..

Uma Mahesh D

Anonymous
Not applicable

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!

fijoy
Contributor

@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

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group