This is an automated email from the ASF dual-hosted git repository. johnbodley pushed a commit to branch john-bodley--fix-celery-eta in repository https://gitbox.apache.org/repos/asf/superset.git
commit f5c4fa1fe8695526488d111698334c75e9becb3c Author: John Bodley <[email protected]> AuthorDate: Tue Jun 27 21:04:32 2023 -0700 fix: Use Celery task ETA for alert/report schedule --- superset/tasks/scheduler.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/superset/tasks/scheduler.py b/superset/tasks/scheduler.py index 7e0422b001..fecd6629f4 100644 --- a/superset/tasks/scheduler.py +++ b/superset/tasks/scheduler.py @@ -64,21 +64,15 @@ def scheduler() -> None: active_schedule.working_timeout + app.config["ALERT_REPORTS_WORKING_SOFT_TIME_OUT_LAG"] ) - execute.apply_async( - ( - active_schedule.id, - schedule, - ), - **async_options, - ) + execute.apply_async((active_schedule.id,), **async_options) @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) -> None: task_id = None try: task_id = execute.request.id - scheduled_dttm_ = parser.parse(scheduled_dttm) + scheduled_dttm = execute.request.eta logger.info( "Executing alert/report, task id: %s, scheduled_dttm: %s", task_id, @@ -87,7 +81,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(
