amoghrajesh commented on code in PR #47996:
URL: https://github.com/apache/airflow/pull/47996#discussion_r2005668587


##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -884,12 +884,21 @@ def finalize(
         _xcom_push(ti, key=xcom_key, value=link)
 
     log.debug("Running finalizers", ti=ti)
-    if state in [TerminalTIState.SUCCESS]:
+    if state == TerminalTIState.SUCCESS:
         get_listener_manager().hook.on_task_instance_success(
             previous_state=TaskInstanceState.RUNNING, task_instance=ti
         )
         # TODO: Run task success callbacks here
-    if state in [TerminalTIState.FAILED, TerminalTIState.FAIL_WITHOUT_RETRY]:
+    elif state == TerminalTIState.FAILED:
+        get_listener_manager().hook.on_task_instance_failed(
+            previous_state=TaskInstanceState.RUNNING, task_instance=ti, 
error=error
+        )
+        if ti._ti_context_from_server and 
ti._ti_context_from_server.should_retry_on_failure:
+            pass  # TODO: Run task retry callbacks here
+        else:
+            # TODO: Run task failure callbacks here
+            state == TerminalTIState.FAIL_WITHOUT_RETRY

Review Comment:
   Don't get why this was added, is it a mistake?



##########
airflow/api_fastapi/execution_api/datamodels/taskinstance.py:
##########
@@ -276,6 +276,9 @@ class TIRunContext(BaseModel):
     xcom_keys_to_clear: Annotated[list[str], Field(default_factory=list)]
     """List of Xcom keys that need to be cleared and purged on by the 
worker."""
 
+    should_retry_on_failure: bool

Review Comment:
   `do_retry` or `eligible_for_retry` i'd say



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to