openverse
openverse copied to clipboard
XCOM pull shorthand function
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.
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 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 🙂