Replies: 1 comment 1 reply
-
|
No - there is no other way currently. But it would likely be a good idea to introduce a special exception that could take result as parameter. Feel free to create a PR or open an issue for it. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone, 👋
I’m working on a dynamic Airflow DAG where each item goes through a sequence of mapped tasks inside a task group (e.g., step_1 -> step_2 -> step_3). Each step may fail for specific items, and when that happens I want to route the original item to a corresponding failure handler to e.g. perform some compensation steps. Below is an example of a desired DAG outline:
And a part of the underlying code for simplicity:
Problem
When the mapped task step_1 fails, Airflow does not return any output, so the failure handler cannot access the original (or even better enriched as per requirements) item via the step result.
I have concluded to a workaround using current context and xcom_push, something like:
This way, I can aggregate on failure flags and achieve my goal. But it easily gets complicated and hard to maintain.
My question:
Is there an Airflow native way to handle this situation, or this idiomatic pattern is the solution here?
Thanks in advance for any guidance! 🙏
Beta Was this translation helpful? Give feedback.
All reactions