dstandish commented on code in PR #28586:
URL: https://github.com/apache/airflow/pull/28586#discussion_r1059133302


##########
airflow/executors/base_executor.py:
##########
@@ -212,16 +253,20 @@ def trigger_tasks(self, open_slots: int) -> None:
             # removed from the running set in the meantime.
             if key in self.running:
                 attempt = self.attempts[key]
-                if attempt < QUEUEING_ATTEMPTS - 1:
-                    self.attempts[key] = attempt + 1
-                    self.log.info("task %s is still running", key)
+                if attempt.can_try_again():
+                    # if it hasn't been much time since first check, let it be 
checked again next time
+                    self.log.info("queued but still running; attempt=%s 
task=%s", attempt.total_tries, key)
                     continue
-
-                # We give up and remove the task from the queue.
-                self.log.error("could not queue task %s (still running after 
%d attempts)", key, attempt)
-                del self.attempts[key]
-                del self.queued_tasks[key]
+                else:
+                    # Otherwise, we give up and remove the task from the queue.
+                    self.log.error(
+                        "could not queue task %s (still running after %d 
attempts)", key, attempt.total_tries
+                    )
+                    del self.attempts[key]
+                    del self.queued_tasks[key]

Review Comment:
   here's my take on this...
   it's purely a stylistic call.  i think sometimes using the else is positive 
w.r.t. readability.  and, since there is no automation enforcing one or the 
other approach, i think we leave it up to individual author.  wdyt?



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