You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by jo...@apache.org on 2023/06/27 23:11:28 UTC

[superset] 01/01: fix: Parsing task schedule

This is an automated email from the ASF dual-hosted git repository.

johnbodley pushed a commit to branch john-bodley--fix-task-scheduler
in repository https://gitbox.apache.org/repos/asf/superset.git

commit a91d519ee2514be35e37d2c91dd36a5420aa61c9
Author: John Bodley <45...@users.noreply.github.com>
AuthorDate: Tue Jun 27 16:11:22 2023 -0700

    fix: Parsing task schedule
---
 superset/tasks/scheduler.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/superset/tasks/scheduler.py b/superset/tasks/scheduler.py
index 7e0422b001..f8024ae1a4 100644
--- a/superset/tasks/scheduler.py
+++ b/superset/tasks/scheduler.py
@@ -15,10 +15,10 @@
 # specific language governing permissions and limitations
 # under the License.
 import logging
+from datetime import datetime
 
 from celery import Celery
 from celery.exceptions import SoftTimeLimitExceeded
-from dateutil import parser
 
 from superset import app, is_feature_enabled
 from superset.commands.exceptions import CommandException
@@ -74,11 +74,10 @@ def scheduler() -> None:
 
 
 @celery_app.task(name="reports.execute", bind=True)
-def execute(self: Celery.task, report_schedule_id: int, scheduled_dttm: str) -> None:
+def execute(self: Celery.task, report_schedule_id: int, scheduled_dttm: datetime) -> None:
     task_id = None
     try:
         task_id = execute.request.id
-        scheduled_dttm_ = parser.parse(scheduled_dttm)
         logger.info(
             "Executing alert/report, task id: %s, scheduled_dttm: %s",
             task_id,
@@ -87,7 +86,7 @@ def execute(self: Celery.task, report_schedule_id: int, scheduled_dttm: str) ->
         AsyncExecuteReportScheduleCommand(
             task_id,
             report_schedule_id,
-            scheduled_dttm_,
+            scheduled_dttm,
         ).run()
     except ReportScheduleUnexpectedError:
         logger.exception(