-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Update WorkflowTrigger to forward failed_stat
#50487
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
Conversation
eladkal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
providers/standard/src/airflow/providers/standard/sensors/external_task.py
Outdated
Show resolved
Hide resolved
|
Looks like we might need to fix some compat issue 🤔 |
1e14d3f to
399ef6e
Compare
|
Pushed for adding test for exception. |
providers/standard/src/airflow/providers/standard/sensors/external_task.py
Outdated
Show resolved
Hide resolved
providers/standard/src/airflow/providers/standard/sensors/external_task.py
Outdated
Show resolved
Hide resolved
399ef6e to
23a1ee4
Compare
|
Mark it draft for fixing failing ci and would reopen when it is ready. |
e7c3048 to
d407b15
Compare
|
CI failure seems fixed in #50521, reopen it for review. |
d407b15 to
0cad112
Compare
0cad112 to
91af5b4
Compare
Lee-W
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks fantastic! Thank you for clarifying the exceptions so much.
|
static checks fails |
Co-authored-by: Wei Lee <weilee.rx@gmail.com>
5d58d1a to
0a1cbfb
Compare
|
I've fixed it. |
a3dc03b to
2047763
Compare
|
Thanks for all reviews and suggestions! |
| if failed_count > 0: | ||
| yield TriggerEvent({"status": "failed"}) | ||
| return | ||
| else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused this why this else removed?
What if there is no allowed_states provided and only provided failed_states? i believe it goes infinite loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing out.
The else statement was removed to ensure that even if no tasks are found in a failed state (failed_count == 0), the trigger proceeds to check the allowed_states. Previously, it would immediately yield a "success" event and exit, bypassing the allowed_states check.
But in the case you've mentioned it would get into infinite loop, originally I've considered that case too. But I think "success" in this context to "the specified failure condition was not met." not really "success". But it do cause issue for users to get into the infinite loop
To address the continuous polling when only failed_states are specified and no failure occurs, maybe we could add this check below to prevent get into the loop. wdyt?
elif not self.allowed_states and not self.skipped_states:
yield TriggerEvent({"status": "success"}) # Or a new status like "no_failure_detected"
return
* Update `external_task` to forward failed_stat * Apply suggestions from code review Co-authored-by: Wei Lee <weilee.rx@gmail.com> * Fix AF2 test --------- Co-authored-by: Wei Lee <weilee.rx@gmail.com>
Related Issue
closes #41140
cc @eladkal
Why
How
WorkflowTriggerto continue checking allowed_states when no failed states are foundExternalTaskSensor.execute_completeto properly handle "failed" status^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.