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/09/14 15:13:25 UTC

[PR] `feature/allow-task-state-store-trigger`: Allowing for Task State Store… [airflow]

jroachgolf84 opened a new pull request, #73135:
URL: https://github.com/apache/airflow/pull/73135

   … to be used on the Triggerer
   
   ## Description
   
   Allowing for the `TaskStateStoreAccessor` to be used on the Triggerer.
   
   ## Testing
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, please
   change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
   -->
   
   - [X] Yes (please specify the tool below)
   
   <!--
   Generated-by: [Claude Opus 5] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   -->
   
   ---
   


-- 
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] Allowing for Task State Store to be used on the Triggerer [airflow]

Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on code in PR #73135:
URL: https://github.com/apache/airflow/pull/73135#discussion_r4058560364


##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -1410,6 +1436,17 @@ async def create_triggers(self):
             trigger_instance.triggerer_job_id = self.job_id
             trigger_instance.timeout_after = workload.timeout_after
 
+            if (ti := workload.ti) is not None:

Review Comment:
   Addressed in next commit!



-- 
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] Allowing for Task State Store to be used on the Triggerer [airflow]

Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on code in PR #73135:
URL: https://github.com/apache/airflow/pull/73135#discussion_r4200635914


##########
airflow-core/tests/unit/triggers/test_base_trigger.py:
##########
@@ -278,6 +278,40 @@ def test_base_event_trigger_asset_state_store_independent_across_instances():
     assert b.asset_state_store is None
 
 
+def test_base_trigger_task_state_store_initialized_to_none():
+    """task_state_store is None before the triggerer injects one."""

Review Comment:
   Resolved locally.



##########
airflow-core/tests/unit/triggers/test_base_trigger.py:
##########
@@ -278,6 +278,40 @@ def test_base_event_trigger_asset_state_store_independent_across_instances():
     assert b.asset_state_store is None
 
 
+def test_base_trigger_task_state_store_initialized_to_none():
+    """task_state_store is None before the triggerer injects one."""
+    trigger = DummyTrigger(name="Dummy Trigger")
+
+    assert trigger.task_state_store is None
+
+
+def test_base_trigger_task_state_store_can_be_set():
+    """task_state_store can be set once the Trigger is initialized."""
+    trigger = DummyTrigger(name="Dummy Trigger")
+
+    mock_store = create_autospec(TaskStateStoreAccessor, instance=True)
+    trigger.task_state_store = mock_store
+
+    assert trigger.task_state_store is mock_store
+
+
+def test_base_trigger_task_state_store_independent_across_instances():
+    """a.task_state_store does not impact b.task_state_store."""

Review Comment:
   Resolved locally.



-- 
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] Allowing for Task State Store to be used on the Triggerer [airflow]

Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on code in PR #73135:
URL: https://github.com/apache/airflow/pull/73135#discussion_r4058561602


##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -124,10 +132,12 @@
     handle_put_variable,
     handle_set_asset_state_store_by_name,
     handle_set_asset_state_store_by_uri,
+    handle_set_task_state_store,
     handle_set_xcom,
 )
 from airflow.sdk.execution_time.supervisor import WatchedSubprocess, make_buffered_socket_reader
 from airflow.sdk.execution_time.task_runner import RuntimeTaskInstance
+from airflow.sdk.state import TaskScope

Review Comment:
   Addressed in next commit!



-- 
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] Allowing for Task State Store to be used on the Triggerer [airflow]

Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on code in PR #73135:
URL: https://github.com/apache/airflow/pull/73135#discussion_r4058579147


##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -1410,6 +1436,17 @@ async def create_triggers(self):
             trigger_instance.triggerer_job_id = self.job_id
             trigger_instance.timeout_after = workload.timeout_after
 
+            if (ti := workload.ti) is not None:
+                trigger_instance.task_state_store = TaskStateStoreAccessor(
+                    ti_id=ti.id,
+                    scope=TaskScope(
+                        dag_id=ti.dag_id,
+                        run_id=ti.run_id,
+                        task_id=ti.task_id,
+                        map_index=ti.map_index,

Review Comment:
   I didn't implement this like you mentioned because `TaskInstanceDTO` defines `map_index` it as a non-optional `int` (which is different than the Worker). The change you mentioned would end up being dead code I believe.
   
   I added `test_task_instance_dto_rejects_a_null_map_index`, so if the field type is ever changed to `int | None` the test fails and flags that the Triggerer now needs the Worker's fallback.



-- 
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] Allowing for Task State Store to be used on the Triggerer [airflow]

Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on code in PR #73135:
URL: https://github.com/apache/airflow/pull/73135#discussion_r4062171974


##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -1399,6 +1425,18 @@ async def create_triggers(self):
                         trigger_instance.task_instance = runtime_ti
                     else:
                         trigger_instance.task_instance = ti
+
+                    # Pass the task_state_store through to the Trigger so it can be used in the Trigger

Review Comment:
   ```suggestion
   ```
   
   Not needed
   
   



##########
airflow-core/tests/unit/jobs/test_triggerer_job.py:
##########
@@ -1033,6 +1043,254 @@ async def test_create_triggers_asset_state_store_accessor_reads_and_writes(
     await runner.cleanup_finished_triggers()
 
 
+@pytest.fixture
+def make_deferred_trigger():
+    """Factory fixture: call with a list to get a BaseTrigger subclass that appends each new instance."""
+
+    def factory(injected_instances):
+        class DeferredTrigger(BaseTrigger):
+            def __init__(self, **kwargs):
+                super().__init__(**kwargs)
+                injected_instances.append(self)
+
+            def serialize(self):
+                return (f"{type(self).__module__}.{type(self).__qualname__}", {})
+
+            async def run(self):
+                yield TriggerEvent("done")
+
+        return DeferredTrigger
+
+    return factory
+
+
+def _ti_dto(map_index=-1):
+    return TaskInstanceDTO(
+        id=uuid.uuid4(),
+        dag_version_id=uuid.uuid4(),
+        task_id="my_task",
+        dag_id="test_dag",
+        run_id="test_run",
+        try_number=1,
+        map_index=map_index,
+        pool_slots=1,
+        queue="default",
+        priority_weight=1,
+    )
+
+
+def test_task_instance_dto_rejects_a_null_map_index():

Review Comment:
   This asserts that pydantic rejects `None` for a field this PR does not touch, so it cannot fail without the PR. It is also in the wrong file: the model lives in airflow-`core/src/airflow/api_fastapi/execution_api/datamodels/taskinstance.py`, so a future change to `int | None` breaks a triggerer test with no hint about the triggerer. Drop it, or move it next to the model with a comment saying the triggerer depends on the field staying non-optional.



##########
airflow-core/tests/unit/triggers/test_base_trigger.py:
##########
@@ -278,6 +278,40 @@ def test_base_event_trigger_asset_state_store_independent_across_instances():
     assert b.asset_state_store is None
 
 
+def test_base_trigger_task_state_store_initialized_to_none():
+    """task_state_store is None before the triggerer injects one."""

Review Comment:
   ```suggestion
   ```
   
   title is good enough



##########
airflow-core/tests/unit/triggers/test_base_trigger.py:
##########
@@ -278,6 +278,40 @@ def test_base_event_trigger_asset_state_store_independent_across_instances():
     assert b.asset_state_store is None
 
 
+def test_base_trigger_task_state_store_initialized_to_none():
+    """task_state_store is None before the triggerer injects one."""
+    trigger = DummyTrigger(name="Dummy Trigger")
+
+    assert trigger.task_state_store is None
+
+
+def test_base_trigger_task_state_store_can_be_set():
+    """task_state_store can be set once the Trigger is initialized."""

Review Comment:
   ```suggestion
   ```
   
   title is good enough



##########
airflow-core/tests/unit/jobs/test_triggerer_job.py:
##########
@@ -1033,6 +1043,254 @@ async def test_create_triggers_asset_state_store_accessor_reads_and_writes(
     await runner.cleanup_finished_triggers()
 
 
+@pytest.fixture
+def make_deferred_trigger():
+    """Factory fixture: call with a list to get a BaseTrigger subclass that appends each new instance."""
+
+    def factory(injected_instances):
+        class DeferredTrigger(BaseTrigger):
+            def __init__(self, **kwargs):
+                super().__init__(**kwargs)
+                injected_instances.append(self)
+
+            def serialize(self):
+                return (f"{type(self).__module__}.{type(self).__qualname__}", {})
+
+            async def run(self):
+                yield TriggerEvent("done")
+
+        return DeferredTrigger
+
+    return factory
+
+
+def _ti_dto(map_index=-1):
+    return TaskInstanceDTO(
+        id=uuid.uuid4(),
+        dag_version_id=uuid.uuid4(),
+        task_id="my_task",
+        dag_id="test_dag",
+        run_id="test_run",
+        try_number=1,
+        map_index=map_index,
+        pool_slots=1,
+        queue="default",
+        priority_weight=1,
+    )
+
+
+def test_task_instance_dto_rejects_a_null_map_index():
+    """If the map_index is None, it should raise an error (it should be -1)."""
+    with pytest.raises(ValidationError):
+        _ti_dto(map_index=None)
+
+
+@pytest.mark.asyncio
+@pytest.mark.parametrize("map_index", [-1, 3], ids=["unmapped", "mapped"])
+@patch("airflow.jobs.triggerer_job_runner.TriggerRunner.get_trigger_by_classpath")
+async def test_create_triggers_injects_task_state_store_scoped_to_the_deferring_ti(
+    mock_get_classpath, session, make_deferred_trigger, map_index
+):
+    """task_state_store is populated, and scoped to the task instance that deferred."""

Review Comment:
   The name already says "injects task state store scoped to the deferring ti".



##########
airflow-core/tests/unit/triggers/test_base_trigger.py:
##########
@@ -278,6 +278,40 @@ def test_base_event_trigger_asset_state_store_independent_across_instances():
     assert b.asset_state_store is None
 
 
+def test_base_trigger_task_state_store_initialized_to_none():
+    """task_state_store is None before the triggerer injects one."""
+    trigger = DummyTrigger(name="Dummy Trigger")
+
+    assert trigger.task_state_store is None
+
+
+def test_base_trigger_task_state_store_can_be_set():
+    """task_state_store can be set once the Trigger is initialized."""
+    trigger = DummyTrigger(name="Dummy Trigger")
+
+    mock_store = create_autospec(TaskStateStoreAccessor, instance=True)
+    trigger.task_state_store = mock_store
+
+    assert trigger.task_state_store is mock_store
+
+
+def test_base_trigger_task_state_store_independent_across_instances():
+    """a.task_state_store does not impact b.task_state_store."""

Review Comment:
   ```suggestion
   ```
   
   title is good enough



-- 
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] Allowing for Task State Store to be used on the Triggerer [airflow]

Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on code in PR #73135:
URL: https://github.com/apache/airflow/pull/73135#discussion_r4200633887


##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -1399,6 +1425,18 @@ async def create_triggers(self):
                         trigger_instance.task_instance = runtime_ti
                     else:
                         trigger_instance.task_instance = ti
+
+                    # Pass the task_state_store through to the Trigger so it can be used in the Trigger

Review Comment:
   Resolved locally.



-- 
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] Allowing for Task State Store to be used on the Triggerer [airflow]

Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on code in PR #73135:
URL: https://github.com/apache/airflow/pull/73135#discussion_r4058579147


##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -1410,6 +1436,17 @@ async def create_triggers(self):
             trigger_instance.triggerer_job_id = self.job_id
             trigger_instance.timeout_after = workload.timeout_after
 
+            if (ti := workload.ti) is not None:
+                trigger_instance.task_state_store = TaskStateStoreAccessor(
+                    ti_id=ti.id,
+                    scope=TaskScope(
+                        dag_id=ti.dag_id,
+                        run_id=ti.run_id,
+                        task_id=ti.task_id,
+                        map_index=ti.map_index,

Review Comment:
   I didn't implement exactly like you mentioned because `TaskInstanceDTO` defines `map_index` it as a non-optional `int`. Since that DTO is built through `model_validate`, Pydantic rejects a `None` before it can reach `TaskScope` 
   
   I added `test_task_instance_dto_rejects_a_null_map_index`, so if the field type is ever changed to `int | None` the test fails and flags that the Triggerer now needs the Worker's fallback.



-- 
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] Allowing for Task State Store to be used on the Triggerer [airflow]

Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on code in PR #73135:
URL: https://github.com/apache/airflow/pull/73135#discussion_r4200647574


##########
airflow-core/tests/unit/triggers/test_base_trigger.py:
##########
@@ -278,6 +278,40 @@ def test_base_event_trigger_asset_state_store_independent_across_instances():
     assert b.asset_state_store is None
 
 
+def test_base_trigger_task_state_store_initialized_to_none():
+    """task_state_store is None before the triggerer injects one."""
+    trigger = DummyTrigger(name="Dummy Trigger")
+
+    assert trigger.task_state_store is None
+
+
+def test_base_trigger_task_state_store_can_be_set():
+    """task_state_store can be set once the Trigger is initialized."""

Review Comment:
   Resolved locally.



-- 
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] Allowing for Task State Store to be used on the Triggerer [airflow]

Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on code in PR #73135:
URL: https://github.com/apache/airflow/pull/73135#discussion_r4200638517


##########
airflow-core/tests/unit/jobs/test_triggerer_job.py:
##########
@@ -1033,6 +1043,254 @@ async def test_create_triggers_asset_state_store_accessor_reads_and_writes(
     await runner.cleanup_finished_triggers()
 
 
+@pytest.fixture
+def make_deferred_trigger():
+    """Factory fixture: call with a list to get a BaseTrigger subclass that appends each new instance."""
+
+    def factory(injected_instances):
+        class DeferredTrigger(BaseTrigger):
+            def __init__(self, **kwargs):
+                super().__init__(**kwargs)
+                injected_instances.append(self)
+
+            def serialize(self):
+                return (f"{type(self).__module__}.{type(self).__qualname__}", {})
+
+            async def run(self):
+                yield TriggerEvent("done")
+
+        return DeferredTrigger
+
+    return factory
+
+
+def _ti_dto(map_index=-1):
+    return TaskInstanceDTO(
+        id=uuid.uuid4(),
+        dag_version_id=uuid.uuid4(),
+        task_id="my_task",
+        dag_id="test_dag",
+        run_id="test_run",
+        try_number=1,
+        map_index=map_index,
+        pool_slots=1,
+        queue="default",
+        priority_weight=1,
+    )
+
+
+def test_task_instance_dto_rejects_a_null_map_index():
+    """If the map_index is None, it should raise an error (it should be -1)."""
+    with pytest.raises(ValidationError):
+        _ti_dto(map_index=None)
+
+
+@pytest.mark.asyncio
+@pytest.mark.parametrize("map_index", [-1, 3], ids=["unmapped", "mapped"])
+@patch("airflow.jobs.triggerer_job_runner.TriggerRunner.get_trigger_by_classpath")
+async def test_create_triggers_injects_task_state_store_scoped_to_the_deferring_ti(
+    mock_get_classpath, session, make_deferred_trigger, map_index
+):
+    """task_state_store is populated, and scoped to the task instance that deferred."""

Review Comment:
   Resolved locally.



-- 
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] Allowing for Task State Store to be used on the Triggerer [airflow]

Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on code in PR #73135:
URL: https://github.com/apache/airflow/pull/73135#discussion_r4056583820


##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -1410,6 +1436,17 @@ async def create_triggers(self):
             trigger_instance.triggerer_job_id = self.job_id
             trigger_instance.timeout_after = workload.timeout_after
 
+            if (ti := workload.ti) is not None:

Review Comment:
   Already checked on line 1391?



##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -1410,6 +1436,17 @@ async def create_triggers(self):
             trigger_instance.triggerer_job_id = self.job_id
             trigger_instance.timeout_after = workload.timeout_after
 
+            if (ti := workload.ti) is not None:
+                trigger_instance.task_state_store = TaskStateStoreAccessor(
+                    ti_id=ti.id,
+                    scope=TaskScope(
+                        dag_id=ti.dag_id,
+                        run_id=ti.run_id,
+                        task_id=ti.task_id,
+                        map_index=ti.map_index,

Review Comment:
   The worker guards this: `map_index=self.map_index if self.map_index is not None else -1`and here there is no guard.
   
   The schema allows `None` and `TaskScope.map_index` is typed int with no runtime check, so a `None` would land in the scope silently. It cannot happen today, since the DTO comes from a non-nullable DB column. But the two sites should match, and a wrong scope would only show up as a custom backend writing to a different path.
   
   While you are here: `_ti_dto()` only ever uses -1 and 3, so no test covers this. Parametrizing over -1, 3, None would lock it in.



##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -124,10 +132,12 @@
     handle_put_variable,
     handle_set_asset_state_store_by_name,
     handle_set_asset_state_store_by_uri,
+    handle_set_task_state_store,
     handle_set_xcom,
 )
 from airflow.sdk.execution_time.supervisor import WatchedSubprocess, make_buffered_socket_reader
 from airflow.sdk.execution_time.task_runner import RuntimeTaskInstance
+from airflow.sdk.state import TaskScope

Review Comment:
   Can yuo add this line into: `generated/known_sdk_imports_in_core.txt`to fix the static checks in CI?



##########
airflow-core/docs/core-concepts/task-state-store.rst:
##########
@@ -152,6 +152,13 @@ Async counterparts of ``get``, ``set``, ``delete``, and ``clear`` for use inside
 
 Calling the synchronous ``get``/``set``/``delete``/``clear`` from inside an ``async`` task blocks the event loop and defeats the concurrency the coroutine was written for. Use the ``a``-prefixed methods there instead.
 
+Using ``task_state_store`` inside a Trigger
+-------------------------------------------
+
+A trigger belonging to a deferred task can read and write that task's state store from within ``run()``. The triggerer injects ``self.task_state_store`` before ``run()`` is called, scoped to the task instance that deferred, which is the same namespace the operator's ``execute()`` and ``execute_complete()`` see. It is not available during ``__init__`` or ``serialize()``, only from within ``run()``.

Review Comment:
   "the same namespace the operator's execute() and execute_complete() see" is only true for the default DB store. It breaks when `[workers] state_store_backend` is set.
   
   The accessor reads that config in whatever process it runs in. Many deployments set `AIRFLOW__WORKERS__STATE_STORE_BACKEND` on worker pods only. Then the triggerer has no backend.
   
   The bad direction is that the operator writes through the backend, and the trigger reads. `_extract_get_response` sees backend is None, skips the unwrap, and returns `{"__external_ref__": "..."}` which is the marker dict, not the value. No warning fires.
   
   Please say in the docs that `[workers] state_store_backend` has to be set the same way on the triggerer.



-- 
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] Allowing for Task State Store to be used on the Triggerer [airflow]

Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on code in PR #73135:
URL: https://github.com/apache/airflow/pull/73135#discussion_r4058559384


##########
airflow-core/docs/core-concepts/task-state-store.rst:
##########
@@ -152,6 +152,13 @@ Async counterparts of ``get``, ``set``, ``delete``, and ``clear`` for use inside
 
 Calling the synchronous ``get``/``set``/``delete``/``clear`` from inside an ``async`` task blocks the event loop and defeats the concurrency the coroutine was written for. Use the ``a``-prefixed methods there instead.
 
+Using ``task_state_store`` inside a Trigger
+-------------------------------------------
+
+A trigger belonging to a deferred task can read and write that task's state store from within ``run()``. The triggerer injects ``self.task_state_store`` before ``run()`` is called, scoped to the task instance that deferred, which is the same namespace the operator's ``execute()`` and ``execute_complete()`` see. It is not available during ``__init__`` or ``serialize()``, only from within ``run()``.

Review Comment:
   Addressed in next commit!



-- 
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] Allowing for Task State Store to be used on the Triggerer [airflow]

Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on code in PR #73135:
URL: https://github.com/apache/airflow/pull/73135#discussion_r4200649069


##########
airflow-core/tests/unit/jobs/test_triggerer_job.py:
##########
@@ -1033,6 +1043,254 @@ async def test_create_triggers_asset_state_store_accessor_reads_and_writes(
     await runner.cleanup_finished_triggers()
 
 
+@pytest.fixture
+def make_deferred_trigger():
+    """Factory fixture: call with a list to get a BaseTrigger subclass that appends each new instance."""
+
+    def factory(injected_instances):
+        class DeferredTrigger(BaseTrigger):
+            def __init__(self, **kwargs):
+                super().__init__(**kwargs)
+                injected_instances.append(self)
+
+            def serialize(self):
+                return (f"{type(self).__module__}.{type(self).__qualname__}", {})
+
+            async def run(self):
+                yield TriggerEvent("done")
+
+        return DeferredTrigger
+
+    return factory
+
+
+def _ti_dto(map_index=-1):
+    return TaskInstanceDTO(
+        id=uuid.uuid4(),
+        dag_version_id=uuid.uuid4(),
+        task_id="my_task",
+        dag_id="test_dag",
+        run_id="test_run",
+        try_number=1,
+        map_index=map_index,
+        pool_slots=1,
+        queue="default",
+        priority_weight=1,
+    )
+
+
+def test_task_instance_dto_rejects_a_null_map_index():

Review Comment:
   Dropped it.



-- 
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] Allowing for Task State Store to be used on the Triggerer [airflow]

Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on PR #73135:
URL: https://github.com/apache/airflow/pull/73135#issuecomment-6168902759

   https://github.com/apache/airflow/pull/74649 is related to this PR here.


-- 
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