You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "villebro (via GitHub)" <gi...@apache.org> on 2023/09/19 01:34:32 UTC

[GitHub] [superset] villebro commented on a diff in pull request #25239: fix: Improve the reliability of alerts & reports

villebro commented on code in PR #25239:
URL: https://github.com/apache/superset/pull/25239#discussion_r1329452625


##########
tests/unit_tests/tasks/test_cron_util.py:
##########
@@ -14,11 +14,9 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from datetime import datetime
 
 import pytest
-import pytz
-from dateutil import parser
-from freezegun import freeze_time

Review Comment:
   I *love* freezegun, hands off @john-bodley! 😄 



##########
superset/tasks/scheduler.py:
##########
@@ -47,9 +48,15 @@ def scheduler() -> None:
         return
     with session_scope(nullpool=True) as session:
         active_schedules = ReportScheduleDAO.find_active(session)
+        triggered_at = (
+            datetime.fromisoformat(scheduler.request.expires)
+            - app.config["CELERY_BEAT_SCHEDULER_EXPIRES"]

Review Comment:
   not your fault, but having to do it like this just makes me cringe.. 😄 I'm hoping someone can add `request.scheduled_at` to Celery 😉 



##########
superset/tasks/scheduler.py:
##########
@@ -47,9 +48,15 @@ def scheduler() -> None:
         return
     with session_scope(nullpool=True) as session:
         active_schedules = ReportScheduleDAO.find_active(session)
+        triggered_at = (
+            datetime.fromisoformat(scheduler.request.expires)
+            - app.config["CELERY_BEAT_SCHEDULER_EXPIRES"]

Review Comment:
   not your fault, but having to do it like this just makes me cringe.. 😄 I'm hoping someone can add `request.scheduled_at` to Celery 😉 



##########
tests/unit_tests/tasks/test_cron_util.py:
##########
@@ -14,11 +14,9 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from datetime import datetime
 
 import pytest
-import pytz
-from dateutil import parser
-from freezegun import freeze_time

Review Comment:
   I *love* freezegun, hands off @john-bodley! 😄 



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org