Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export values in py tasks with sub param #974

Open
jaymed opened this issue Feb 8, 2019 · 3 comments
Open

Export values in py tasks with sub param #974

jaymed opened this issue Feb 8, 2019 · 3 comments
Labels

Comments

@jaymed
Copy link

jaymed commented Feb 8, 2019

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.

@hiroyuki-sato
Copy link
Contributor

Hello, @jaymed

You can't use ${} syntax in _export part in the current implementation.
I'll add more detail later.

@chezou
Copy link
Member

chezou commented Feb 8, 2019

seems like same issue as #678 or #862 ?

@jaymed
Copy link
Author

jaymed commented Feb 8, 2019

seems like same issue as #678 or #862 ?

Thanks, @chezou. It's exactly like #678. I'll have to come up with a different way to pass nested parameters to my python function.

I'm also finding that secrets can't be evaluated as py parameters, even if they aren't nested.

+setup:
  py>: tasks.MyWorkflow.step1
  arg1: ${secret:password}

Without the ability to pass in dates from _export data or secrets to py operators, I'm really limited in what I can do with digdag.

@yoyama yoyama added the bug label Apr 8, 2019
@yoyama yoyama self-assigned this Apr 8, 2019
yoyama pushed a commit to yoyama/digdag that referenced this issue Apr 8, 2019
If nested, no information provided, failed to substitute the variable.
This is related to treasure-data#974, treasure-data#678.
@yoyama yoyama removed their assignment Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants