Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(reports): Improving logging around failed scheduled reports #19924

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions superset/tasks/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def scheduler() -> None:

@celery_app.task(name="reports.execute")
def execute(report_schedule_id: int, scheduled_dttm: str) -> None:
task_id = None
try:
task_id = execute.request.id
scheduled_dttm_ = parser.parse(scheduled_dttm)
Expand All @@ -80,12 +81,14 @@ def execute(report_schedule_id: int, scheduled_dttm: str) -> None:
report_schedule_id,
scheduled_dttm_,
).run()
except ReportScheduleUnexpectedError as ex:
logger.error(
"An unexpected occurred while executing the report: %s", ex, exc_info=True
except ReportScheduleUnexpectedError:
logger.exception(
"An unexpected occurred while executing the report: %s", task_id
)
except CommandException:
logger.exception(
"A downstream exception occurred while generating" " a report: %s", task_id
)
except CommandException as ex:
logger.info("Report state: %s", ex)


@celery_app.task(name="reports.prune_log")
Expand All @@ -95,8 +98,4 @@ def prune_log() -> None:
except SoftTimeLimitExceeded as ex:
logger.warning("A timeout occurred while pruning report schedule logs: %s", ex)
except CommandException as ex:
logger.error(
"An exception occurred while pruning report schedule logs: %s",
ex,
exc_info=True,
)
logger.exception("An exception occurred while pruning report schedule logs")