JoelEmmanuelCloud commented on code in PR #76410:
URL: https://github.com/apache/airflow/pull/76410#discussion_r4644217378


##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -3912,6 +4190,23 @@ def adopt_or_reset_orphaned_tasks(self, *, session: 
Session = NEW_SESSION) -> in
                         self.log.info("Marked %d SchedulerJob instances as 
failed", num_failed)
                         stats.incr(self.__class__.__name__.lower() + "_end", 
num_failed)
 
+                    # A separate statement, not folded into the SchedulerJob 
one above, so the
+                    # "Marked %d SchedulerJob instances as failed" log line 
and the _end metric keep
+                    # counting only schedulers. These ExecutorJob rows are 
left running with no
+                    # end_date when their owning scheduler is SIGKILLed or 
OOM-killed, since _execute's
+                    # own cleanup (_end_executor_jobs) never gets to run for 
that case; this also
+                    # catches a row a health check still in flight at that 
moment recreates after
+                    # _end_executor_jobs has already closed the others.
+                    session.execute(

Review Comment:
   added a test for it.



-- 
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