Hi @John_Rotenstein, Job-level parameters in notebook code can be retrieved using the dbutils.jobs.taskValues.get()
command.
This command allows tasks to output values that can be referenced in subsequent tasks within a job run.
For instance, if you have two notebook tasks, Get_user_data
and Analyze_user_data
, and you want to pass a user's name and age from the Get_user_data
task to the Analyze_user_data
task, you can use the dbutils.jobs.taskValues.set()
to set these values in the Get_user_data
task and then use dbutils.jobs.taskValues.get()
to retrieve these values in the Analyze_user_data
task.
Here is an example of how to develop and retrieve task values:
python
# Set task values in the 'Get_user_data' task
dbutils.jobs.taskValues.set(key = 'name', value = 'Some User')
dbutils.jobs.taskValues.set(key = "age", value = 30)
# Get task values in the 'Analyze_user_data' task
dbutils.jobs.taskValues.get(taskKey = "Get_user_data", key = "age", default = 42, debugValue = 0)
dbutils.jobs.taskValues.get(taskKey = "Get_user_data", key = "name", default = "Jane Doe")
In the dbutils.jobs.taskValues.get()
command, the taskKey
is the name of the job task setting the value, the key
is the name of the task value's key, default
is an optional value that is returned if key
cannot be found, and debugValue
It is an optional value that is returned if you try to get the task value from within a notebook running outside a job.