amoghrajesh commented on code in PR #44954:
URL: https://github.com/apache/airflow/pull/44954#discussion_r1889669499
##########
task_sdk/tests/execution_time/test_task_runner.py:
##########
@@ -333,6 +333,52 @@ def __init__(self, *args, **kwargs):
)
[email protected](
+ ["dag_id", "task_id", "fail_with_exception"],
+ [
+ pytest.param(
+ "basic_failed", "fail-exception", AirflowFailException("Oops.
Failing by AirflowFailException!")
+ ),
+ pytest.param(
+ "basic_failed2",
+ "sensor-timeout-exception",
+ AirflowSensorTimeout("Oops. Failing by AirflowSensorTimeout!"),
+ ),
+ ],
+)
+def test_run_basic_failed(time_machine, mocked_parse, dag_id, task_id,
fail_with_exception, make_ti_context):
+ """Test running a basic task that marks itself as failed by raising
exception."""
+ from airflow.providers.standard.operators.python import PythonOperator
+
+ task = PythonOperator(
+ task_id=task_id,
+ python_callable=lambda: (_ for _ in ()).throw(
+ fail_with_exception,
+ ),
+ )
Review Comment:
That was not the intention here. In task_runner tests I am trying to instead
create situations where certain `exceptions` translate to certain states. Here
for example, the `AirflowFailException` and `AirflowSensorTimeout` lead to
failed 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]