EinavDanielDX opened a new issue #19301:
URL: https://github.com/apache/superset/issues/19301
After scheduling a report for either chart of dashboard, using smtp, The
report fails to send the message with the following error in worker pod:
```
[2022-03-21 14:29:00,298: INFO/ForkPoolWorker-15] Init selenium driver
/usr/local/lib/python3.8/site-packages/celery/platforms.py:800:
RuntimeWarning: You're running the worker with superuser privileges: this is
absolutely not recommended!
Please specify a different user using the --uid option.
User information: uid=0 euid=0 gid=0 egid=0
warnings.warn(RuntimeWarning(ROOT_DISCOURAGED.format(
Scheduling alert my_test eta: 2022-03-21 14:30:00
[2022-03-21 14:30:00,102: INFO/ForkPoolWorker-16] Scheduling alert my_test
eta: 2022-03-21 14:30:00
Report state: Report Schedule is still working, refusing to re-compute.
[2022-03-21 14:30:00,293: INFO/ForkPoolWorker-16] Report state: Report
Schedule is still working, refusing to re-compute.
Selenium timed out requesting url
https://my-domain/superset/slice/75/?standalone=true&standalone=3
Traceback (most recent call last):
File "/app/superset/utils/webdriver.py", line 122, in get_screenshot
element = WebDriverWait(driver, self._screenshot_locate_wait).until(
File
"/usr/local/lib/python3.8/site-packages/selenium/webdriver/support/wait.py",
line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
[2022-03-21 14:30:45,988: WARNING/ForkPoolWorker-15] Selenium timed out
requesting url https://my-domain/superset/slice/75/?standalone=true&standalone=3
Traceback (most recent call last):
File "/app/superset/utils/webdriver.py", line 122, in get_screenshot
element = WebDriverWait(driver, self._screenshot_locate_wait).until(
File
"/usr/local/lib/python3.8/site-packages/selenium/webdriver/support/wait.py",
line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
Report state: Failed taking a screenshot local variable 'element' referenced
before assignment
[2022-03-21 14:30:46,136: INFO/ForkPoolWorker-15] Report state: Failed
taking a screenshot local variable 'element' referenced before assignment
Scheduling alert my_test eta: 2022-03-21 14:31:00
```
Also, in under reports -> logs in UI screen i see this error
`Failed taking a screenshot local variable 'element' referenced before
assignment`
#### How to reproduce the bug
1 - setup alerts, smtp and google chrome driver for selenium
2 - schedule a report
3 - follow logs
### Expected results
An email with the relevant dashboard/chart should be sent
### Actual results
Selenium fails to take a screenshot fails, I'm getting an email with a
failure message as described above
#### Screenshots

### Environment
- browser type and version: `chrome 99.0.4844.51`
- superset version: `1.4.1`
- python version: `Python 3.8.12`
- deployment method: helm chart
- any feature flags active:
my configuration
```
FEATURE_FLAGS = {
"DYNAMIC_PLUGINS": True,
"ENABLE_TEMPLATE_PROCESSING": True,
"VERSIONED_EXPORT": True,
"ALERT_REPORTS": True
}
from celery.schedules import crontab
REDIS_HOST = env('REDIS_HOST')
REDIS_PORT = env('REDIS_PORT')
class CeleryConfig:
BROKER_URL = 'redis://%s:%s/0' % (REDIS_HOST, REDIS_PORT)
CELERY_IMPORTS = ('superset.sql_lab', "superset.tasks",
"superset.tasks.thumbnails", )
CELERY_RESULT_BACKEND = 'redis://%s:%s/0' % (REDIS_HOST,
REDIS_PORT)
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': 600,
'soft_time_limit': 600,
'ignore_result': True,
},
}
CELERYBEAT_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
# # Slack configuration
# SLACK_API_TOKEN = "xoxb-"
# Email configuration
THUMBNAIL_SELENIUM_USER = '[email protected]'
ENABLE_SCHEDULED_EMAIL_REPORTS = True
SMTP_HOST = env('SMTP_HOST')
SMTP_USER = env('SMTP_USER')
SMTP_PASSWORD = env('SMTP_PASSWORD')
SMTP_PORT = env('SMTP_PORT')
SMTP_SSL = False
SMTP_STARTTLS = True
SMTP_MAIL_FROM = env('SMTP_MAIL_FROM')
# WebDriver configuration
# If you use Firefox, you can stick with default values
# If you use Chrome, then add the following WEBDRIVER_TYPE and
WEBDRIVER_OPTION_ARGS
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",
]
# This is for internal use, you can keep http
WEBDRIVER_BASEURL=env('DASHBOARDS_BASE_URL')
# This is the link sent to the recipient, change to your domain eg.
https://superset.mydomain.com
WEBDRIVER_BASEURL_USER_FRIENDLY=env('DASHBOARDS_BASE_URL')
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]