Stefan-Koch
Databricks Partner

hi ctiwari7

A possible way to do that, you create a python file which generates the uuid and then pass it to jobs.taskValues. This is described here: https://docs.databricks.com/en/jobs/task-values.html 

As test, I created a python file, with the following content:

 

import uuid

uuid = str(uuid.uuid4())

print(uuid)

dbutils.jobs.taskValues.set(key = "uuid", value = uuid)

 

The file will be added as task in a databricks job.

StefanKoch_0-1732638676813.png

For the demo, I have a simple notebook which takes a widget as parameter:

StefanKoch_1-1732638717745.png

In the job, I add a second task, where I refer to the notebook:

StefanKoch_2-1732638761389.png

In the parameter field: put the following information:
name: uuid
value:  {{tasks.create_uuid.values.uuid}}

StefanKoch_3-1732638818391.png