Search code examples
apache-superset

Superset chart email schedules and celery beat schedule. Why report is sent with celery beat schedule instead of chart email schedules?


My configured email report is named "Raw player games" with crontab */20 * * * * (At every 20th minute I will expect a report in my email box). Look in the screenshot raw player games.

Another crontab is configured in main superset config - superset_config.py

# superset_config.py

    CELERYBEAT_SCHEDULE = {
        'email_reports.schedule_hourly': {
            'task': 'email_reports.schedule_hourly',
            'schedule': crontab(minute=1, hour='*'), # At minute 1, every hour
        },
    }

I receive emails, but only one per hour. I don't see any errors in logs, all jobs in celery flower are in success state.

apache-superset==0.37.2
celery==4.4.7

Why? Why superset send me reports only once in a hour? How to reconfigure superset to correctly handle my crontabs, what I missed?


Solution

  • Note that your beat schedule is configured to run hourly. So on every minute one of each hour, beat is going to enqueue a new job that will verify if it's time to send a new report. It will not matter to have a thinner resolution configured on superset itself.

    Yet by default email reports functionality has an hourly resolution:

    https://github.com/apache/incubator-superset/blob/master/superset/tasks/schedules.py#L823

    This default can be changed by configuring: EMAIL_REPORTS_CRON_RESOLUTION