You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2026/05/10 02:13:10 UTC
(airflow) branch main updated: Convert STATES_SENT_DIRECTLY to frozenset for O(1) membership lookup (#66317)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 10d1e6ea1e7 Convert STATES_SENT_DIRECTLY to frozenset for O(1) membership lookup (#66317)
10d1e6ea1e7 is described below
commit 10d1e6ea1e751157a57c77a839d1f26bc0b77bdb
Author: Colten <ju...@gmail.com>
AuthorDate: Sun May 10 10:13:02 2026 +0800
Convert STATES_SENT_DIRECTLY to frozenset for O(1) membership lookup (#66317)
---
task-sdk/src/airflow/sdk/execution_time/supervisor.py | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/task-sdk/src/airflow/sdk/execution_time/supervisor.py b/task-sdk/src/airflow/sdk/execution_time/supervisor.py
index b8f2eeff045..757a73b7e2e 100644
--- a/task-sdk/src/airflow/sdk/execution_time/supervisor.py
+++ b/task-sdk/src/airflow/sdk/execution_time/supervisor.py
@@ -182,13 +182,15 @@ SERVER_TERMINATED = "SERVER_TERMINATED"
# These are the task instance states that require some additional information to transition into.
# "Directly" here means that the PATCH API calls to transition into these states are
# made from _handle_request() itself and don't have to come all the way to wait().
-STATES_SENT_DIRECTLY = [
- TaskInstanceState.DEFERRED,
- TaskInstanceState.UP_FOR_RESCHEDULE,
- TaskInstanceState.UP_FOR_RETRY,
- TaskInstanceState.SUCCESS,
- SERVER_TERMINATED,
-]
+STATES_SENT_DIRECTLY: frozenset[TaskInstanceState | str] = frozenset(
+ {
+ TaskInstanceState.DEFERRED,
+ TaskInstanceState.UP_FOR_RESCHEDULE,
+ TaskInstanceState.UP_FOR_RETRY,
+ TaskInstanceState.SUCCESS,
+ SERVER_TERMINATED,
+ }
+)
# Setting a fair buffer size here to handle most message sizes. Intention is to enforce a buffer size
# that is big enough to handle small to medium messages while not enforcing hard latency issues