jedcunningham commented on code in PR #32985:
URL: https://github.com/apache/airflow/pull/32985#discussion_r1280904062
##########
airflow/models/taskinstance.py:
##########
@@ -187,19 +187,28 @@ def set_current_context(context: Context) ->
Generator[Context, None, None]:
)
-def stop_all_tasks_in_dag(tis: list[TaskInstance], session: Session,
task_id_to_ignore: int):
+def _stop_remaining_tasks(*, dag: DAG, tis: list[TaskInstance],
task_id_to_ignore: str, session: Session):
+ """
+ Stop non-teardown tasks in dag.
+
+ :meta private:
+ """
for ti in tis:
if ti.task_id == task_id_to_ignore or ti.state in (
TaskInstanceState.SUCCESS,
TaskInstanceState.FAILED,
):
continue
if ti.state == TaskInstanceState.RUNNING:
- log.info("Forcing task %s to fail", ti.task_id)
+ log.info("Forcing task %s to fail due to dag's `fail_stop`
setting", ti.task_id)
ti.error(session)
else:
- log.info("Setting task %s to SKIPPED", ti.task_id)
- ti.set_state(state=TaskInstanceState.SKIPPED, session=session)
+ task = dag.task_dict[ti.task_id]
+ if not task.is_teardown:
Review Comment:
Don't you need to check this for the running case too?
##########
airflow/models/dag.py:
##########
@@ -2711,6 +2712,7 @@ def add_logger_if_needed(ti: TaskInstance):
secrets_backend_list.insert(0, local_secrets)
execution_date = execution_date or timezone.utcnow()
+ self.validate()
Review Comment:
Why do we need to add this?
##########
airflow/models/taskinstance.py:
##########
@@ -187,19 +187,28 @@ def set_current_context(context: Context) ->
Generator[Context, None, None]:
)
-def stop_all_tasks_in_dag(tis: list[TaskInstance], session: Session,
task_id_to_ignore: int):
+def _stop_remaining_tasks(*, dag: DAG, tis: list[TaskInstance],
task_id_to_ignore: str, session: Session):
Review Comment:
What do you think about making this a little less generic, and instead of
accepting a list of tis and a single "task_id_to_ignore", let it use self to
query and ignore all right 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]