rusackas commented on code in PR #41502:
URL: https://github.com/apache/superset/pull/41502#discussion_r3565184852


##########
superset/utils/cache.py:
##########
@@ -73,7 +73,7 @@ def set_and_log_cache(
     if timeout == CACHE_DISABLED_TIMEOUT:
         return
     try:
-        dttm = datetime.utcnow().isoformat().split(".")[0]
+        dttm = 
datetime.now(timezone.utc).replace(tzinfo=None).isoformat().split(".")[0]

Review Comment:
   Added the annotation on `dttm`.



##########
superset/commands/report/execute.py:
##########
@@ -558,22 +560,28 @@ def _get_screenshots(self) -> list[bytes]:
                         "Screenshot failed; aborting to avoid sending a 
partial report"
                     )
                 imges.append(imge)
-            elapsed_seconds = (datetime.utcnow() - start_time).total_seconds()
+            elapsed_seconds = (
+                datetime.now(timezone.utc).replace(tzinfo=None) - start_time
+            ).total_seconds()

Review Comment:
   Added the annotation here too.



##########
superset/commands/report/execute.py:
##########
@@ -736,15 +746,19 @@ def _get_csv_data(self) -> bytes:
                 self._execution_id,
             )
         except SoftTimeLimitExceeded as ex:
-            elapsed_seconds = (datetime.utcnow() - start_time).total_seconds()
+            elapsed_seconds = (
+                datetime.now(timezone.utc).replace(tzinfo=None) - start_time
+            ).total_seconds()

Review Comment:
   Added the annotation here too.



##########
superset/commands/report/execute.py:
##########
@@ -786,15 +802,19 @@ def _get_embedded_data(self) -> pd.DataFrame:
                 self._execution_id,
             )
         except SoftTimeLimitExceeded as ex:
-            elapsed_seconds = (datetime.utcnow() - start_time).total_seconds()
+            elapsed_seconds = (
+                datetime.now(timezone.utc).replace(tzinfo=None) - start_time
+            ).total_seconds()

Review Comment:
   Added the annotation on `elapsed_seconds`.



##########
superset/commands/report/execute.py:
##########
@@ -1192,7 +1212,10 @@ def next(self) -> None:
                 self._report_schedule
             )
             elapsed_seconds = (
-                (datetime.utcnow() - last_working.end_dttm).total_seconds()
+                (
+                    datetime.now(timezone.utc).replace(tzinfo=None)
+                    - last_working.end_dttm
+                ).total_seconds()
                 if last_working
                 else None
             )

Review Comment:
   Added the annotation here too.



##########
superset/commands/report/execute.py:
##########
@@ -1409,7 +1432,9 @@ def run(self) -> None:
                     self._execution_id, self._model, self._scheduled_dttm
                 ).run()
 
-            elapsed_seconds = (datetime.utcnow() - start_time).total_seconds()
+            elapsed_seconds = (
+                datetime.now(timezone.utc).replace(tzinfo=None) - start_time
+            ).total_seconds()

Review Comment:
   Added the annotation here too.



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