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

superset alerts vs alerts & reports #13007

Closed
taitai42 opened this issue Feb 8, 2021 · 5 comments
Closed

superset alerts vs alerts & reports #13007

taitai42 opened this issue Feb 8, 2021 · 5 comments
Labels
alert-reports Namespace | Anything related to the Alert & Reports feature

Comments

@taitai42
Copy link

taitai42 commented Feb 8, 2021

Hello guys,

i'm trying to set a fresh superset instance to send alerts using docker-compose
i've added a celery beat and flower instance to my docker compose,
i've changed the superset_config to add the following parameters :

ENABLE_SCHEDULED_EMAIL_REPORTS = True
ALERTS_REPORTS = True
FEATURE_FLAGS = {
    'ALERTS_REPORTS': True,
    "THUMBNAILS": True
}

RESULTS_BACKEND = RedisCache(host=REDIS_HOST, port=REDIS_PORT, key_prefix='superset_results')

EMAIL_REPORTS_WEBDRIVER = 'firefox'
EMAIL_REPORTS_USER = 'Admin'
WEBDRIVER_BASEURL = "http://0.0.0.0:8088/"

ENABLE_ALERTS = True

THUMBNAIL_SELENIUM_USER = "Admin"

DATA_CACHE_CONFIG = {
    'CACHE_TYPE': 'redis',
    'CACHE_DEFAULT_TIMEOUT': 60 * 60 * 24, # 1 day default (in secs)
    'CACHE_REDIS_URL': f'redis://{REDIS_HOST}:{REDIS_PORT}/0',
}

class CeleryConfig(object):
    BROKER_URL = f'redis://{REDIS_HOST}:{REDIS_PORT}/0'
    CELERY_IMPORTS = (
        'superset.sql_lab',
        'superset.tasks',
    )
    CELERY_RESULT_BACKEND = f'redis://{REDIS_HOST}:{REDIS_PORT}/0'
    CELERYD_LOG_LEVEL = 'DEBUG'
    CELERYD_PREFETCH_MULTIPLIER = 10
    CELERY_ACKS_LATE = True
    CELERY_ANNOTATIONS = {
        'sql_lab.get_sql_results': {
            'rate_limit': '100/s',
        },
        'email_reports.send': {
            'rate_limit': '1/s',
            'time_limit': 120,
            'soft_time_limit': 150,
            'ignore_result': True,
        },
    }
    CELERYBEAT_SCHEDULE = {
        'email_reports.schedule_hourly': {
            'task': 'email_reports.schedule_hourly',
            'schedule': crontab(minute='*', hour='*'),
        },
        'alerts.schedule_check': {
            'task': 'alerts.schedule_check',
            'schedule': crontab(minute='*', hour='*')
        },
    }

CELERY_CONFIG = CeleryConfig

i end up having the following options in my superset :
image
any alerts set into the alerts, or email schedule through dashboard emails are properly sent,

but the ones set through the alerts & reports menu are not being triggered at all, i don't even see the task sent to celery.

i don't find anything that could help me on the doc, does anyone run into the same issue?

thanks

@junlincc junlincc added global:alert alert-reports Namespace | Anything related to the Alert & Reports feature labels Feb 8, 2021
@taitai42 taitai42 closed this as completed Feb 8, 2021
@taitai42
Copy link
Author

taitai42 commented Feb 8, 2021

found out the celery task name for alerts&reports is reports.scheduler
added the config to celery and now works like a charm.

closing the issue

@nytai
Copy link
Member

nytai commented Feb 8, 2021

@taitai42 nice name :)

Yes, there's some important config missing for the new alerts and reports feature. We're working on patching this gap in config and docs. Here's the PR to fix the issue you just noticed, #12999

@Asturias-sam
Copy link

@taitai42 i am getting this error when using above config
NameError: name 'crontab' is not defined, how you are importing it ?

@taitai42
Copy link
Author

hey @Asturias-sam
from celery.schedules import crontab

@Asturias-sam
Copy link

@taitai42 ya it's working fine... can you please share your config file... i think i am missing something as alerts are not begin triggered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alert-reports Namespace | Anything related to the Alert & Reports feature
Projects
None yet
Development

No branches or pull requests

4 participants