cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
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..

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

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.