amoghrajesh commented on code in PR #44977:
URL: https://github.com/apache/airflow/pull/44977#discussion_r1888043150
##########
task_sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -283,9 +283,28 @@ def run(ti: RuntimeTaskInstance, log: Logger):
...
except (AirflowFailException, AirflowSensorTimeout):
# If AirflowFailException is raised, task should not retry.
+ # If a sensor in reschedule mode reaches timeout, task should not
retry.
+
+ # TODO: Handle fail_stop here:
https://github.com/apache/airflow/issues/44951
+ # TODO: Handle addition to Log table:
https://github.com/apache/airflow/issues/44952
+ msg = TaskState(
+ state=TerminalTIState.FAILED,
+ end_date=datetime.now(tz=timezone.utc),
+ )
+
+ # TODO: Run task failure callbacks here
+ except AirflowTaskTimeout:
+ # TODO: handle the case of up_for_retry here
...
- except (AirflowTaskTimeout, AirflowException, AirflowTaskTerminated):
- ...
+ except (AirflowException, AirflowTaskTerminated):
Review Comment:
Okay, with the older design, it looks like we should retry here. I created a
dag:
```
from time import sleep
from airflow import DAG
from airflow.providers.standard.operators.python import PythonOperator
from datetime import datetime, timedelta
from airflow.sdk.definitions.baseoperator import AirflowException
def print_hello():
raise AirflowException("I am failing, bye")
with DAG(
dag_id="hello_world_single_task",
default_args={
"owner": "airflow",
"depends_on_past": False,
"retries": 1,
},
description="A simple Hello World DAG with one task",
schedule=None,
start_date=datetime(2024, 1, 1),
catchup=False,
tags=["example"],
) as dag:
hello_task = PythonOperator(
task_id="say_hello",
execution_timeout=timedelta(seconds=1),
python_callable=print_hello,
)
```
Marked as up_for_retry.
![Uploading image.png…]()
Let me make the changes to achieve that.
--
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]