openverse icon indicating copy to clipboard operation
openverse copied to clipboard

XCOM pull shorthand function

Open AetherUnbound opened this issue 3 years ago • 1 comments

Description

We presently have a number of XCOM_PULL_TEMPLATE.format(...) calls as part of our DAG definitions. Since this is a frequently used templated string, it would be nice to have a shorthand utility function for it. E.g.:

def xcom_pull(operator: BaseOperator, key: str = "return_value"):
    return XCOM_PULL_TEMPLATE.format(
        operator.task_id,
        key
    )

Defaulting to return_value would allow us to make very simple calls for simple XComs.

We could then go through and replace all instances of XCOM_PULL_TEMPLATE formatting with this function instead.

Additional context

Discussed on the Make WordPress Slack here.

Implementation

  • [ ] 🙋 I would be interested in implementing this feature.

AetherUnbound avatar Jul 29 '22 21:07 AetherUnbound

Hey @AetherUnbound , please confirm if i understood correctly , we need to create a utility function which returns XCOM_PULL_TEMPLATE template string and replace it where ever XCOM_PULL_TEMPLATE.format is being used

Is there a file where i can add the utility function

munch-lax avatar May 05 '24 14:05 munch-lax

@munch-lax actually, I think a better option would be the approach outlined in #2295! I'm going to close this issue in favor of that. Do you feel like you'd be willing to take that other issue on instead? I'd be happy to help point you in the right direction on it, if you had any questions 🙂

AetherUnbound avatar May 06 '24 21:05 AetherUnbound