dstandish commented on code in PR #43520:
URL: https://github.com/apache/airflow/pull/43520#discussion_r1835163642
##########
airflow/jobs/scheduler_job_runner.py:
##########
@@ -1796,28 +1808,95 @@ def _fail_tasks_stuck_in_queued(self, session: Session
= NEW_SESSION) -> None:
)
).all()
+ num_allowed_retries = conf.getint("scheduler",
"num_stuck_in_queued_retries")
for executor, stuck_tis in
self._executor_to_tis(tasks_stuck_in_queued).items():
- try:
- cleaned_up_task_instances =
set(executor.cleanup_stuck_queued_tasks(tis=stuck_tis))
- for ti in stuck_tis:
- if repr(ti) in cleaned_up_task_instances:
- self.log.warning(
- "Marking task instance %s stuck in queued as
failed. "
- "If the task instance has available retries, it
will be retried.",
- ti,
+ tis: Iterable[TaskInstance] = []
+ with suppress(NotImplementedError):
+ # BaseExecutor has "abstract" method
`cleanup_stuck_queued_tasks`
+ # We are tolerant of implementers not implementing it.
+ tis = executor.cleanup_stuck_queued_tasks(tis=stuck_tis)
+ for ti in tis:
+ if not isinstance(ti, TaskInstance):
+ # todo: when can we remove this?
+ # this is for backcompat. the pre-2.10.4 version of the
interface
+ # expected a string return val.
+ self.log.warning(
+ "Task instance %s stuck in queued. May be set to
failed.",
Review Comment:
outdated; we added new func
##########
airflow/jobs/scheduler_job_runner.py:
##########
@@ -1796,28 +1808,95 @@ def _fail_tasks_stuck_in_queued(self, session: Session
= NEW_SESSION) -> None:
)
).all()
+ num_allowed_retries = conf.getint("scheduler",
"num_stuck_in_queued_retries")
for executor, stuck_tis in
self._executor_to_tis(tasks_stuck_in_queued).items():
- try:
- cleaned_up_task_instances =
set(executor.cleanup_stuck_queued_tasks(tis=stuck_tis))
- for ti in stuck_tis:
- if repr(ti) in cleaned_up_task_instances:
- self.log.warning(
- "Marking task instance %s stuck in queued as
failed. "
- "If the task instance has available retries, it
will be retried.",
- ti,
+ tis: Iterable[TaskInstance] = []
+ with suppress(NotImplementedError):
+ # BaseExecutor has "abstract" method
`cleanup_stuck_queued_tasks`
+ # We are tolerant of implementers not implementing it.
+ tis = executor.cleanup_stuck_queued_tasks(tis=stuck_tis)
+ for ti in tis:
+ if not isinstance(ti, TaskInstance):
+ # todo: when can we remove this?
+ # this is for backcompat. the pre-2.10.4 version of the
interface
+ # expected a string return val.
+ self.log.warning(
+ "Task instance %s stuck in queued. May be set to
failed.",
+ ti,
+ )
+ continue
+
+ self.log.warning("Task stuck in queued and may be requeued.
task_id=%s", ti.key)
Review Comment:
updated
--
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]