giftig commented on code in PR #29893:
URL: https://github.com/apache/superset/pull/29893#discussion_r1710854888


##########
superset/migrations/env.py:
##########
@@ -54,6 +54,12 @@
 # ... etc.
 
 
+def print_duration(start_time: float) -> None:
+    duration = time.time() - start_time
+    formatted_time = time.strftime("%H:%M:%S", time.gmtime(duration))
+    logger.info(f"Migration scripts completed. Duration: {formatted_time}")

Review Comment:
   Nitpick but usually you should let the logger format the message for you 
rather than doing it yourself, since the logger will do it lazily and avoid 
having to do the formatting if INFO leve llogs are off, for example.



##########
superset/migrations/env.py:
##########
@@ -117,6 +130,7 @@ def process_revision_directives(  # pylint: 
disable=redefined-outer-name, unused
     try:
         with context.begin_transaction():
             context.run_migrations()
+            print_duration(start_time)

Review Comment:
   Should this be outside the transaction context? I assume the context manager 
here is going to commit the transaction on exit, so it's not really done until 
that happens.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to