superset icon indicating copy to clipboard operation
superset copied to clipboard

How to use “email report”?

Open sandy-ha opened this issue 7 years ago • 20 comments

I Can't follow the documentation. I can't see the entry in the menue? Should the Admin see this? I have a local installation and admin rights. image

Or is it a bug?

sandy-ha avatar Sep 09 '19 12:09 sandy-ha

Issue-Label Bot is automatically applying the label #question to this issue, with a confidence of 0.90. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

issue-label-bot[bot] avatar Sep 09 '19 12:09 issue-label-bot[bot]

You need to set ENABLE_SCHEDULED_EMAIL_REPORTS = True in your config.py file

lilila avatar Sep 11 '19 08:09 lilila

I tried it. I have inserted ENABLE_SCHEDULED_EMAIL_REPORTS = True, but the menu items are still not displayed.

sandy-ha avatar Sep 16 '19 07:09 sandy-ha

Same problem: ENABLE_SCHEDULED_EMAIL_REPORTS = True inserts the divider, but "Dashboard Email Schedules" and "Chart Emails" are not visible. image

alex-mark avatar Sep 16 '19 11:09 alex-mark

I am unable to reproduce the error locally on admin account on master; have you tried this on either 0.34 or master and followed the upgrade instructions?

villebro avatar Sep 18 '19 21:09 villebro

@sandy-ha please run superset init again in terminal, because FAB(FlaskAppbuilder) will initialize reporter menu access permission

zhaoyongjie avatar Sep 21 '19 14:09 zhaoyongjie

@zhaoyongjie, thank you. It works

alex-mark avatar Sep 24 '19 20:09 alex-mark

return self.run(*args, **kwargs)

File "/home/superset/superset/tasks/schedules.py", line 386, in schedule_email_report deliver_slice(schedule) File "/home/superset/superset/tasks/schedules.py", line 350, in deliver_slice email = _get_slice_data(schedule) File "/home/superset/superset/tasks/schedules.py", line 277, in _get_slice_data response = opener.open(slice_url) File "/usr/local/lib/python3.6/urllib/request.py", line 532, in open response = meth(req, response) File "/usr/local/lib/python3.6/urllib/request.py", line 642, in http_response 'http', request, response, code, msg, hdrs) File "/usr/local/lib/python3.6/urllib/request.py", line 570, in error return self._call_chain(*args) File "/usr/local/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(*args) File "/usr/local/lib/python3.6/urllib/request.py", line 650, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) OSError Mail can't be sent out

DaDong-G avatar Sep 25 '19 03:09 DaDong-G

This is my setup

WEBDRIVER_BASEURL = "http://chrome:4444/wd/hub"
EMAIL_REPORTS_WEBDRIVER = "chrome"

DaDong-G avatar Sep 25 '19 03:09 DaDong-G

class CustomCeleryConfig(object):
    BROKER_URL = 'redis://%s:%s/0' % (REDIS_HOST, REDIS_PORT)
    CELERY_IMPORTS = ('superset.sql_lab', )
    CELERY_RESULT_BACKEND = 'redis://%s:%s/1' % (REDIS_HOST, REDIS_PORT)
    CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'}}
    CELERY_TASK_PROTOCOL = 1
    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=1, hour="*"),
        }
    }

Celery configuration , The mail task will be scheduled, but an error will be reported.

DaDong-G avatar Sep 25 '19 03:09 DaDong-G

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

stale[bot] avatar Nov 24 '19 04:11 stale[bot]

This is my setup

WEBDRIVER_BASEURL = "http://chrome:4444/wd/hub"
EMAIL_REPORTS_WEBDRIVER = "chrome"

why do you set WEBDRIVER_BASEURL = "http://chrome:4444/wd/hub"? And I have another question, why the default port in WEBDRIVER_BASEURL is 8080, not 8088.

shawnz42 avatar Jan 08 '20 03:01 shawnz42

i have enabled the email service in my config.py but getting below error when trying to create the email report : Screenshot from 2020-01-26 11-36-33 Can anyone please guide ?

Jarvis173 avatar Jan 26 '20 06:01 Jarvis173

You need to set ENABLE_SCHEDULED_EMAIL_REPORTS = True in your config.py file

I have enabled this setting and did superset init from terminal. But when i tried creating a report i got below error : Screenshot from 2020-01-26 11-36-33 Can you please assist ?

Jarvis173 avatar Jan 26 '20 06:01 Jarvis173

@Jarvis173 probably you have missing mandatory parameter during adding new schedule record. It might be because of for eg. you left "crontab" section empty,invalid, etc.

mgulaydin avatar Feb 01 '20 12:02 mgulaydin

@Jarvis173 probably you have missing mandatory parameter during adding new schedule record. It might be because of for eg. you left "crontab" section empty,invalid, etc.

Now i've set crontab as "*/5 * * * *" , the job is created but i haven't received a test mail yet. What else do i need to configure.

Jarvis173 avatar Feb 01 '20 17:02 Jarvis173

@Jarvis173 probably you have missing mandatory parameter during adding new schedule record. It might be because of for eg. you left "crontab" section empty,invalid, etc.

Now i've set crontab as "*/5 * * * *" , the job is created but i haven't received a test mail yet. What else do i need to configure.

Have you got the answer- Did you get the email? i am also facing the same problem.

devesharora90 avatar Jun 04 '20 08:06 devesharora90

I have the same issue as @Jarvis173 & @devesharora90, my users get Registration e-mails but not the reports. Did you come across any tips & tricks to make it work?

Green-Angry-Bird avatar Jul 09 '20 14:07 Green-Angry-Bird

This is my setup

WEBDRIVER_BASEURL = "http://chrome:4444/wd/hub"
EMAIL_REPORTS_WEBDRIVER = "chrome"

why do you set WEBDRIVER_BASEURL = "http://chrome:4444/wd/hub"? And I have another question, why the default port in WEBDRIVER_BASEURL is 8080, not 8088.

How did u setup chrome driver?

Lavanya-Mohan avatar Jul 16 '20 13:07 Lavanya-Mohan

This is my setup

WEBDRIVER_BASEURL = "http://chrome:4444/wd/hub"
EMAIL_REPORTS_WEBDRIVER = "chrome"

why do you set WEBDRIVER_BASEURL = "http://chrome:4444/wd/hub"? And I have another question, why the default port in WEBDRIVER_BASEURL is 8080, not 8088.

pluralize(len(dupes), 'name'), ', '.join(sorted(dupes)), [2020-07-16 07:58:12,838: ERROR/ForkPoolWorker-1] Task email_reports.send[40ab936e-096a-492d-b3e9-e1694212da22] raised unexpected: AttributeError("'NoneType' object has no attribute 'is_active'",) Traceback (most recent call last): File "/opt/apps/ENVS/superset/lib/python3.6/site-packages/celery/app/trace.py", line 385, in trace_task R = retval = fun(*args, **kwargs) File "/opt/apps/ENVS/superset/lib/python3.6/site-packages/superset/app.py", line 114, in call return task_base.call(self, *args, **kwargs) File "/opt/apps/ENVS/superset/lib/python3.6/site-packages/celery/app/trace.py", line 650, in protected_call return self.run(*args, **kwargs) File "/opt/apps/ENVS/superset/lib/python3.6/site-packages/superset/tasks/schedules.py", line 381, in schedule_email_report deliver_slice(schedule) File "/opt/apps/ENVS/superset/lib/python3.6/site-packages/superset/tasks/schedules.py", line 342, in deliver_slice email = _get_slice_data(schedule) File "/opt/apps/ENVS/superset/lib/python3.6/site-packages/superset/tasks/schedules.py", line 264, in _get_slice_data for cookie in _get_auth_cookies(): File "/opt/apps/ENVS/superset/lib/python3.6/site-packages/superset/tasks/schedules.py", line 129, in _get_auth_cookies login_user(user) File "/opt/apps/ENVS/superset/lib/python3.6/site-packages/flask_login/utils.py", line 158, in login_user if not force and not user.is_active: AttributeError: 'NoneType' object has no attribute 'is_active' How to resolve this error?

Lavanya-Mohan avatar Jul 16 '20 13:07 Lavanya-Mohan