You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jroachgolf84 (via GitHub)" <gi...@apache.org> on 2026/05/13 18:01:02 UTC
[PR] `fix/issue-66877`: Handle `None` Task ID state when "matching states" in `ExternalTaskSensor` [airflow]
jroachgolf84 opened a new pull request, #66881:
URL: https://github.com/apache/airflow/pull/66881
## Description
Per #66877:
> The Airflow 3 task-group path asks the Execution API for a map of task states, then counts a Dag run as matching when every observed truthy state is in `allowed_states`. This means a task-group state map containing only `None` values, or a mix of successful tasks and `None` values, is counted as a successful group.
To handle this, the `if state` logic was removed from the generation of the object being evaluated with `all()`. Instead, `None` values remained in the object, and were evaluated with `all()` (which then returns `False`, the intended behavior). A check for the list of matching states was also added.
## Testing
To validate these changes, a number of parameterizations were added to `providers/standard/tests/unit/standard/utils/test_sensor_helper.py::test_get_count_by_matched_states`. These tests can be run using the command below:
```bash
breeze testing providers-tests providers/standard/tests/unit/standard/utils/test_sensor_helper.py
```
* closes: #66877
##### Was generative AI tooling used to co-author this PR?
No, generative AI tooling was NOT used to co-author this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Handle `None` Task ID state when matching states in `ExternalTaskSensor` [airflow]
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal merged PR #66881:
URL: https://github.com/apache/airflow/pull/66881
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Handle `None` Task ID state when matching states in `ExternalTaskSensor` [airflow]
Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on PR #66881:
URL: https://github.com/apache/airflow/pull/66881#issuecomment-4466855386
@potiuk, do you mind reviewing this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Handle `None` Task ID state when matching states in `ExternalTaskSensor` [airflow]
Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on PR #66881:
URL: https://github.com/apache/airflow/pull/66881#issuecomment-4480339838
@eladkal - do you mind merging this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] `fix/issue-66877`: Handle `None` Task ID state when "matching states" in `ExternalTaskSensor` [airflow]
Posted by "nathadfield (via GitHub)" <gi...@apache.org>.
nathadfield commented on code in PR #66881:
URL: https://github.com/apache/airflow/pull/66881#discussion_r3247573352
##########
providers/standard/src/airflow/providers/standard/utils/sensor_helper.py:
##########
@@ -144,6 +144,11 @@ def _get_count_by_matched_states(
):
count = 0
for _, task_states in run_id_task_state_map.items():
- if all(state in states for state in task_states.values() if state):
+ # Create this list such that len() can be checked in the conditional (to handle empty inner)
+ matched_states: list = [state in states for state in task_states.values()]
+
+ # An empty inner, such as {"r": {}}, results in count NOT being incremented
+ if len(matched_states) > 0 and all(matched_states):
Review Comment:
@jroachgolf84 Looks like you've got a small formatting issue to deal with.
```suggestion
if len(matched_states) > 0 and all(matched_states):
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org