digdag icon indicating copy to clipboard operation
digdag copied to clipboard

Export values in py tasks with sub param

Open jaymed opened this issue 6 years ago • 3 comments

I'm trying to call a python task with a parameter that contain a list of dictionary values by using _export variables. The variables used to define the values in the list of dictionaries are not being interpolated.

Please consider the following example. In this case I would like arg2 to be an array of dictionary values. In this case the arg1 param evaluates correctly but the value of subarg2 contains the literal definition of relevant_date instead of the interpolated value.

timezone: UTC
_export:
  relevant_date: ${moment(session_time).utc().format('YYYYMMDD')}

+setup:
  py>: tasks.MyWorkflow.step1
  arg1: ${relevant_date}
  arg2:
    subarg2: ${relevant_date}

The output looks like this:

20190207
{u'subarg2': u"${moment(session_time).utc().format('YYYYMMDD')}"}

The sample python task looks like this:

import digdag

class MyWorkflow(object):
    def step1(self, arg1, arg2):
        print (arg1)
        print (arg2)

Please help me understand how I can properly interpolate the value of subarg2.

jaymed avatar Feb 08 '19 01:02 jaymed