o-nikolas commented on code in PR #30361:
URL: https://github.com/apache/airflow/pull/30361#discussion_r1153576043


##########
airflow/executors/base_executor.py:
##########
@@ -216,6 +215,8 @@ def heartbeat(self) -> None:
         self.log.debug("%s in queue", num_queued_tasks)
         self.log.debug("%s open slots", open_slots)
 
+        from airflow.stats import Stats

Review Comment:
   Thanks for having a look TP!
   
   > From what I can tell these modules are very barebone and should only cost 
a fraction to import?
   
   When I tested these two modules individually they were taking 600-800ms to 
load (vs cheap modules taking an order of magnitude less such as 50-90ms).
   
   > And the pure import time save seems marginal at best since they need to be 
imported for pretty much anything anywhere for the executor to be actually 
useful.
   
   In cases like the CLI usecase, we're not using the executor in that way 
(i.e. instantiating it) so any savings on import can be quite impactful 
actually.
   
   Also these particular modules were an easy win, since they're only used in 
one place each. So it was pretty easy/clean to move the import closer to where 
it was used.



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