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

Apache Superset 3.0.1 Alert Report is delivered after 30 min #25944

Closed
koustavnest opened this issue Nov 10, 2023 · 9 comments
Closed

Apache Superset 3.0.1 Alert Report is delivered after 30 min #25944

koustavnest opened this issue Nov 10, 2023 · 9 comments
Labels
need:more-info Requires more information from author

Comments

@koustavnest
Copy link

I have installed Apache superset 3.0.1 . I have setup Celery server with Redis in background. I have scheduled an report for specific time. In celery server , it take the message after 30 minutes of scheduled time and delivery the email.
Can you please help me where which package should I change to get the scheduled email as per scheduled time.

I have faced the same issue in apache superset 2.1.0 and downgrade the packages and it is working fine.

pip install Flask==2.1.3
pip install kombu==5.2.4
pip install MarkupSafe==2.1.2
pip install rich==13.3.5
pip install trio-websocket==0.10.2
pip install typing_extensions==4.6.2
pip install urllib3==2.0.2
pip install tzdata==2023.3

But, for Apache superset 3.1.0 ,those package downgrade is not allowed.

Can you suggest me how to fix this issue?

Expected results

I want to deliver scheduled report as per time set in Alert/Report not after 30 mins

Actual results

It will pick the scheduled entry after 30 mins of scheduled time and delivered the email.

Screenshots

image

If applicable, add screenshots to help explain your problem.

Environment

Linux

@sfirke
Copy link
Member

sfirke commented Nov 14, 2023

Strange. Could it be a timezone thing, if it's precisely a 30 minute delay and the timezone is set to Kolkata? Maybe try playing with timezone settings?

Is the report event not triggered until 30 minutes late?

@sfirke sfirke added the need:more-info Requires more information from author label Nov 14, 2023
@koustavnest
Copy link
Author

Yes, I found that in Apache Superset Alert/Report feature works only UTC timezone. Can it be possible to schedule Alert/Report based on my selected GMT Timezone? It will be helpful if anyone help me about to set Alert/Report based on Timezone

@sfirke
Copy link
Member

sfirke commented Nov 15, 2023

It should work if you specify the timezone you want in the alert/report configuration. For instance I have a report configured like this:
image

And then when I hit save it looks like this:
image

And it respects my chosen timezone and sends at 7:00am USA Eastern Time (GMT -5).

@koustavnest
Copy link
Author

I have used broker_url as Redis Server and set result_backend as PostgreSQL Database.
In PostgreSQL, timezone is set as default my current timezone.
It was worked for me Apache Superset 2.1.0 with downgrade the package as
pip install Flask==2.1.3
pip install kombu==5.2.4
pip install MarkupSafe==2.1.2
pip install rich==13.3.5
pip install trio-websocket==0.10.2
pip install typing_extensions==4.6.2
pip install urllib3==2.0.2
pip install tzdata==2023.3

But, in Apache Superset celery server 5.3.4 dose not support kombu >=5.3.3.
In Superset_config.py , I have added this line to celeryconfig

from celery.schedules import crontab
REDIS_HOST = "localhost"
REDIS_PORT = "7000"
import ssl

class CeleryConfig(object):

imports = (
    'superset.sql_lab',
    'superset.tasks',
)
broker_url = "redis://localhost:7000/0"
result_backend = 'db+postgresql://postgres:XXXX@localhost/XXXX'
task_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,
    },
}
task_protocol = 1
beat_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

It is working for me if I schedule Report as per UTC Time and change Postgres DB timezone as UTC.

Are you use Celery Server and Redis as broker URL and PostgreSQL as back end ?

Can you please help me where should I change to get Schedule Email in GMT time

@sfirke
Copy link
Member

sfirke commented Nov 16, 2023

Hrm I'm surprised this changed from 2.1.0 to 3.0.1 😕

Yes I'm using Celery and Redis in Docker containers and an external PostgreSQL DB. I never configured the timezone on the Postgres DB so I expect it's still in UTC.

I'm not sure how to troubleshoot this one further unfortunately. Maybe join the Superset Slack chat and see if anyone there can help?

@jaga4b3
Copy link

jaga4b3 commented Dec 12, 2023

I have used broker_url as Redis Server and set result_backend as PostgreSQL Database. In PostgreSQL, timezone is set as default my current timezone. It was worked for me Apache Superset 2.1.0 with downgrade the package as pip install Flask==2.1.3 pip install kombu==5.2.4 pip install MarkupSafe==2.1.2 pip install rich==13.3.5 pip install trio-websocket==0.10.2 pip install typing_extensions==4.6.2 pip install urllib3==2.0.2 pip install tzdata==2023.3

But, in Apache Superset celery server 5.3.4 dose not support kombu >=5.3.3. In Superset_config.py , I have added this line to celeryconfig

from celery.schedules import crontab REDIS_HOST = "localhost" REDIS_PORT = "7000" import ssl

class CeleryConfig(object):

imports = (
    'superset.sql_lab',
    'superset.tasks',
)
broker_url = "redis://localhost:7000/0"
result_backend = 'db+postgresql://postgres:XXXX@localhost/XXXX'
task_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,
    },
}
task_protocol = 1
beat_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

It is working for me if I schedule Report as per UTC Time and change Postgres DB timezone as UTC.

Are you use Celery Server and Redis as broker URL and PostgreSQL as back end ?

Can you please help me where should I change to get Schedule Email in GMT time

Could you assist me in configuring alerts? I've employed Docker Compose, and while the alerts are being triggered, I'm not receiving any notifications; it appears they might be test alerts. Interestingly, even without enabling any feature flags, the system indicates that alerts have been triggered. What could be the reason for this behavior?

@sfirke
Copy link
Member

sfirke commented Dec 12, 2023

@jaga4b3 this GitHub issue is related to a 30 minute offset in when reports are delivered. It sounds like you have another problem. Feel free to open a GitHub discussion or join the Superset Slack chat and @ mention me in either location - but let's leave this issue focused on a single problem please.

@jaga4b3
Copy link

jaga4b3 commented Dec 13, 2023

@jaga4b3 this GitHub issue is related to a 30 minute offset in when reports are delivered. It sounds like you have another problem. Feel free to open a GitHub discussion or join the Superset Slack chat and @ mention me in either location - but let's leave this issue focused on a single problem please.

@sfirke . I've figured out my issue.. Thanks for replying.

@rusackas
Copy link
Member

@jaga4b3 glad it got resolved! If you see an opportunity to improve docs or something so others don't get stuck, let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need:more-info Requires more information from author
Projects
None yet
Development

No branches or pull requests

4 participants