apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
63.16k stars 13.99k forks source link

Unable to trigger reports & alerts in Superset #19789

Closed Mohtasim878 closed 11 months ago

Mohtasim878 commented 2 years ago

Hi All, I have enabled alerts reports in superset version:1.4.2. I am able to create them but they arent triggering (Nothing Triggered). I tried multiple ways but still cant.

Below is the Log

**Log:

2022-04-15 15:25:08,868:DEBUG:cron_descriptor.GetText:Failed to find locale None 2022-04-15 15:25:08,898:INFO:werkzeug:127.0.0.1 - - [15/Apr/2022 15:25:08] "←[37mGET /api/v1/report/?q=(filters:!((col:type,opr:eq,value:Report)),order_column:name,order_direction:desc,page:0,page_size:25) HTTP/1.1←[0m" 200 - Also here config.py file if some one can review and resend if am missing anything thanks: config.txt**

cemremengu commented 2 years ago

Have you started a celery worker and a celery beat instance/container? If so, you need to check worker logs.

see https://superset.apache.org/docs/installation/alerts-reports/#docker-compose

Mohtasim878 commented 2 years ago

Hey @cemremengu thanks for your response i followed doc and those in config file . As Am beginner so could you please guide me how to start its instance. I installed superset on windows using following link : https://www.youtube.com/watch?v=Sb_At33QPfw

Config File: class CeleryConfig: # pylint: disable=too-few-public-methods BROKER_URL = "sqla+sqlite:///celerydb.sqlite" CELERY_IMPORTS = ("superset.sql_lab", "superset.tasks") CELERY_RESULT_BACKEND = "db+sqlite:///celery_results.sqlite" CELERYD_LOG_LEVEL = "DEBUG" CELERYD_PREFETCH_MULTIPLIER = 1 CELERY_ACKS_LATE = False CELERY_ANNOTATIONS = { "sql_lab.get_sql_results": {"rate_limit": "100/s"}, "email_reports.send": { "rate_limit": "1/s", "time_limit": int(timedelta(seconds=120).total_seconds()), "soft_time_limit": int(timedelta(seconds=150).total_seconds()), "ignore_result": True, }, } CELERYBEAT_SCHEDULE = { "email_reports.schedule_hourly": { "task": "email_reports.schedule_hourly", "schedule": crontab(minute=1, hour=""), }, "reports.scheduler": { "task": "reports.scheduler", "schedule": crontab(minute="", hour="*"), }, "reports.prune_log": { "task": "reports.prune_log", "schedule": crontab(minute=0, hour=0), }, }

CELERY_CONFIG = CeleryConfig # pylint: disable=invalid-name

M3gar00 commented 2 years ago

Any updates on this issue? Were you able to get it to work? I'm seeing the same behavior and I have a similar configuration.

kishan7492 commented 1 year ago

I'm having the same issue. I'm using the https://hub.docker.com/r/apache/superset Docker Image with a 2.1.0 flag.

ya-msh commented 1 year ago

Hi, I have 2.1.0 installed from scratch via pip on Ubuntu and had a similar experience. At the start point, the only difference in the log is that a locale is found: 2023-07-12 16:48:12,235:DEBUG:cron_descriptor.GetText:./cron_descriptor/locale/fr_FR.mo Loaded

But next it happens nothing indeed, so I investigated… It seems Celery is not managed by Superset processes, so we have to start manually Celery worker and beat. I did it with these commands:

celery --app superset.tasks.celery_app:app worker --pool=prefork --max-tasks-per-child=128 -O fair &
celery --app superset.tasks.celery_app:app beat &

Connection with Superset is established: I see my scheduled reports logged in terminal: it is a good thing. Example: Scheduling alert Test mail text eta: 2023-07-12 15:37:00

Unfortunately after that I had a lot of other issues.

1°) KeyError: 'email_reports.schedule_hourly' Lines 778 -> 781 in config.py are not recognized. => I commented it and error disappeared

2°) TypeError: Parser must be a string or character stream, not datetime In superset/tasks/scheduler.py, I replaced line 81 by scheduled_dttm_ = scheduled_dttm

And I think I progressed because logs go much further:

[2023-07-12 19:08:00,253: INFO/ForkPoolWorker-2] Scheduling alert Test mail text eta: 2023-07-12 17:08:00
[2023-07-12 19:08:01,256: INFO/ForkPoolWorker-4] Executing alert/report, task id: 3405cd9d-5624-48ef-be0a-3b6e7b4a2cca, scheduled_dttm: 2023-07-12 17:08:00
[2023-07-12 19:08:01,257: INFO/ForkPoolWorker-4] session is validated: id 3, executionid: 3405cd9d-5624-48ef-be0a-3b6e7b4a2cca
[2023-07-12 19:08:01,275: INFO/ForkPoolWorker-4] Running report schedule 3405cd9d-5624-48ef-be0a-3b6e7b4a2cca as user admin
[2023-07-12 19:08:01,331: INFO/ForkPoolWorker-4] Getting chart from http://0.0.0.0:8080/api/v1/chart/7/data/?format=json&type=post_processed&force=false as user admin

Ultimately I have other errors, among others:

[2023-07-12 19:08:01,357: WARNING/ForkPoolWorker-4] SupersetError(message='[Errno -2] Name or service not known', error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra=None)
ConnectionRefusedError: [Errno 111] Connection refused

But the good news is that finally, the run is returned in "Alerts & Report" page => see screenshot Superset_Reports_last_run_KO

To be continued…

sfirke commented 11 months ago

The original post is pretty stale now and the replies have various contributing factors. "Unable to trigger reports & alerts in Superset" is too broad to be actionable. I'm going to close this.

If people are looking for debugging help on configuring Alerts & Reports, please post a GitHub Discussion or join the Superset Slack chat (link on main Superset repo page). If you believe you've found a bug in the Superset software, please create a new, specific issue.