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: 

DAB for_each_task - Passing task values

DarioB
New Contributor II

I am trying to deploy a job with a for_each_task using DAB and Terraform and I am unable to properly pass the task value into the subsequent task.

These are my job tasks definition in the YAML:

      tasks:
        - task_key: FS_batching
          job_cluster_key: job_cluster_fs
          notebook_task:
            notebook_path: ...
        - task_key: FS_processing
          depends_on:
            - task_key: FS_batching
          for_each_task:
            inputs: {{tasks.FS_batching.values.var_name}}
            task:
              task_key: processing_iteration
              job_cluster_key: job_cluster_fs
              notebook_task:
                notebook_path: ....
                base_parameters:
                  input: {{input}}
 
For feeding the parameter into inputs and input fields I have tried different formats:
- {{tasks.FS_batching.values.var_name}}
- "{{tasks.FS_batching.values.var_name}}"
- ${tasks.FS_batching.values.var_name}
 
All of them failing with different errors. It seem that Terraform get crazy with those calls, any idea on how to solve it?
 

I am setting the parameter with: dbutils.jobs.taskValues.set(...) and retrieving it through: dbutils.widgets.get() because I am using scala in my notebooks and task values only seem to work with Python, so I use the widgets to retrieve them. But this should not mess with parameter setup into yaml.

1 ACCEPTED SOLUTION

Accepted Solutions

DarioB
New Contributor II

We have been testing and find out the issue (I just realized that my anonymization of the names removed the source of the error).

We have tracked down to the inputs parameter of the for_each_task. It seems that is unable to call to task names with dashes: "{{tasks.Task-ETL_Get_Params.values.key}}" won't work because of the -. You can either use underscores or shortcut with ``: "{{tasks.`Task-ETL_Get_Params`.values.key}}".

 

I hope this helps to other people.

View solution in original post

1 REPLY 1

DarioB
New Contributor II

We have been testing and find out the issue (I just realized that my anonymization of the names removed the source of the error).

We have tracked down to the inputs parameter of the for_each_task. It seems that is unable to call to task names with dashes: "{{tasks.Task-ETL_Get_Params.values.key}}" won't work because of the -. You can either use underscores or shortcut with ``: "{{tasks.`Task-ETL_Get_Params`.values.key}}".

 

I hope this helps to other people.

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now