Code Monkey home page Code Monkey logo

Comments (6)

dosubot avatar dosubot commented on June 27, 2024 3

To resolve the issue with setting up alerts and reports in Apache Superset, you need to ensure that the Redis service is properly configured and activated. Based on your provided configuration, it appears that the broker_url and result_backend for Celery are not set, which are essential for connecting to the Redis service.

Here is the updated configuration with the necessary Redis settings:

FEATURE_FLAGS = {
    'ALERT_REPORTS' : True,
    'DASHBOARD_RBAC': True,
    'ENABLE_TEMPLATE_PROCESSING': True,
}

from celery.schedules import crontab

REDIS_HOST = "localhost"  # Change this to your Redis host
REDIS_PORT = "6379"       # Change this to your Redis port if different
REDIS_CELERY_DB = "0"
REDIS_RESULTS_DB = "1"

class CeleryConfig:
    broker_url = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CELERY_DB}"
    result_backend = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_RESULTS_DB}"
    beat_schedule = {
        "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

SCREENSHOT_LOCATE_WAIT = 100
SCREENSHOT_LOAD_WAIT = 600

ALERT_REPORTS = True
EMAIL_NOTIFICATIONS = True
ALERT_REPORTS_NOTIFICATION_DRY_RUN = False

EMAIL_NOTIFICATIONS = False  # all the emails are sent using dryrun
SMTP_HOST = "SMTP_HOST"
SMTP_STARTTLS = True
SMTP_SSL = True
SMTP_USER = "SMTP_USER"
SMTP_PORT = 465
SMTP_PASSWORD = "SMTP_PASSWORD"
SMTP_MAIL_FROM = "SMTP_MAIL_FROM"
SMTP_SSL_SERVER_AUTH = False

WEBDRIVER_TYPE = "chrome"
WEBDRIVER_OPTION_ARGS = [
    "--force-device-scale-factor=2.0",
    "--high-dpi-support=2.0",
    "--headless",
    "--disable-gpu",
    "--disable-dev-shm-usage",
    "--no-sandbox",
    "--disable-setuid-sandbox",
    "--disable-extensions",
]

WEBDRIVER_BASEURL = "http://localhost:8088"
WEBDRIVER_BASEURL_USER_FRIENDLY = "http://IP:8088"

from superset.tasks.types import ExecutorType

THUMBNAIL_SELENIUM_USER = 'admin'
ALERT_REPORTS_EXECUTE_AS = [ExecutorType.SELENIUM]

Make sure that the Redis service is running and accessible at the specified REDIS_HOST and REDIS_PORT. This should enable the Celery workers to connect to Redis and process the tasks for alerts and reports. Additionally, ensure that the REDIS_CELERY_DB and REDIS_RESULTS_DB are correctly set to match your Redis configuration [1][2].

To continue talking to Dosu, mention @dosu.

from superset.

dosubot avatar dosubot commented on June 27, 2024 3

It looks like you have correctly configured the Redis settings for Celery. However, there are a few additional configurations and checks you should ensure are in place:

  1. Enable the ALERT_REPORTS Feature Flag:
    Ensure that the ALERT_REPORTS feature flag is enabled in your configuration:

    FEATURE_FLAGS = {
        'ALERT_REPORTS': True,
        'DASHBOARD_RBAC': True,
        'ENABLE_TEMPLATE_PROCESSING': True,
    }
  2. Set ALERT_REPORTS_NOTIFICATION_DRY_RUN to False:
    Make sure this setting is correctly set to False to enable actual notifications:

    ALERT_REPORTS_NOTIFICATION_DRY_RUN = False
  3. Configure the WebDriver:
    Ensure that the WebDriver is correctly configured for taking screenshots:

    WEBDRIVER_TYPE = "chrome"
    WEBDRIVER_OPTION_ARGS = [
        "--force-device-scale-factor=2.0",
        "--high-dpi-support=2.0",
        "--headless",
        "--disable-gpu",
        "--disable-dev-shm-usage",
        "--no-sandbox",
        "--disable-setuid-sandbox",
        "--disable-extensions",
    ]
    WEBDRIVER_BASEURL = "http://localhost:8088"
    WEBDRIVER_BASEURL_USER_FRIENDLY = "http://IP:8088"
  4. Set the User for Rendering Dashboards:
    Ensure that the user for rendering dashboards is set:

    from superset.tasks.types import ExecutorType
    
    THUMBNAIL_SELENIUM_USER = 'admin'
    ALERT_REPORTS_EXECUTE_AS = [ExecutorType.SELENIUM]
  5. Check Celery Workers:
    Ensure that Celery workers are running and can connect to Redis. You can start the Celery worker with:

    celery -A superset.tasks.celery_app:app worker --loglevel=info
  6. Check Celery Beat:
    Ensure that Celery beat is running to schedule tasks:

    celery -A superset.tasks.celery_app:app beat --loglevel=info
  7. Verify Redis Connection:
    Ensure that Redis is running and accessible. You can test the connection using a Redis client:

    redis-cli -h localhost -p 6379 ping
  8. SMTP Configuration:
    Ensure that your SMTP settings are correctly configured for email notifications:

    SMTP_HOST = "SMTP_HOST"
    SMTP_STARTTLS = True
    SMTP_SSL = True
    SMTP_USER = "SMTP_USER"
    SMTP_PORT = 465
    SMTP_PASSWORD = "SMTP_PASSWORD"
    SMTP_MAIL_FROM = "SMTP_MAIL_FROM"
    SMTP_SSL_SERVER_AUTH = False

By ensuring these configurations and checks are in place, you should be able to set up alerts and reports in Apache Superset 4.0.1. If the issue persists, check the Superset logs for any errors or warnings that might provide more insights [1][2].

To continue talking to Dosu, mention @dosu.

from superset.

bionexit avatar bionexit commented on June 27, 2024

I installed the redis manually, and update the config as following, but NO LUCK

from celery.schedules import crontab

REDIS_HOST = "localhost"  # Change this to your Redis host
REDIS_PORT = "6379"       # Change this to your Redis port if different
REDIS_CELERY_DB = "0"
REDIS_RESULTS_DB = "1"

class CeleryConfig:
    broker_url = f"redis://{REDIS_HOST}:{REDIS_PORT}/0"
    imports = (
        "superset.sql_lab",
        "superset.tasks.scheduler",
    )
    result_backend = f"redis://{REDIS_HOST}:{REDIS_PORT}/0"
    worker_prefetch_multiplier = 10
    task_acks_late = True
    task_annotations = {
        "sql_lab.get_sql_results": {
            "rate_limit": "100/s",
        },
    }
    beat_schedule = {
        "reports.scheduler": {
            "task": "reports.scheduler",
            "schedule": crontab(minute="*", hour="*"),
        },
        "reports.prune_log": {
            "task": "reports.prune_log",
            "schedule": crontab(minute=0, hour=0),
        },
    }

In report log, seems no error message, but no email was sent or received.

image

from superset.

bionexit avatar bionexit commented on June 27, 2024

after config as above, the log report STARTTLS extension not supported by server.

from superset.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.