sxfang32 opened a new issue, #24750:
URL: https://github.com/apache/superset/issues/24750

   hi~ 
    I encountered the following problem when using the scheduled email feature 
in Superset.
   
   system:centos 7.8
   Python 3.8.11
   pip install apache-superset==2.1.0
   pip install celery==5.2.7
   
   chrome version:Google Chrome 108.0.5359.124
   chromedriver verison:ChromeDriver 108.0.5359.22
   
   error message :
   ```shell
   [2023-07-20 10:00:00,074: INFO/ForkPoolWorker-1] Scheduling alert ?????? 
eta: 2023-07-20 02:00:00
   [2023-07-20 10:00:00,079: ERROR/ForkPoolWorker-1] Task 
reports.execute[c32a2a9d-b87c-4db5-8504-82a3c28bb768] raised unexpected: 
TypeError('Parser must be a string or character stream, not datetime')
   Traceback (most recent call last):
     File 
"/root/.virtualenvs/superset/lib/python3.8/site-packages/celery/app/trace.py", 
line 451, in trace_task
       R = retval = fun(*args, **kwargs)
     File 
"/root/.virtualenvs/superset/lib/python3.8/site-packages/superset/initialization/__init__.py",
 line 108, in __call__
       return task_base.__call__(self, *args, **kwargs)
     File 
"/root/.virtualenvs/superset/lib/python3.8/site-packages/celery/app/trace.py", 
line 734, in __protected_call__
       return self.run(*args, **kwargs)
     File 
"/root/.virtualenvs/superset/lib/python3.8/site-packages/superset/tasks/scheduler.py",
 line 81, in execute
       scheduled_dttm_ = parser.parse(scheduled_dttm)
     File 
"/root/.virtualenvs/superset/lib/python3.8/site-packages/dateutil/parser/_parser.py",
 line 1368, in parse
       return DEFAULTPARSER.parse(timestr, **kwargs)
     File 
"/root/.virtualenvs/superset/lib/python3.8/site-packages/dateutil/parser/_parser.py",
 line 640, in parse
       res, skipped_tokens = self._parse(timestr, **kwargs)
     File 
"/root/.virtualenvs/superset/lib/python3.8/site-packages/dateutil/parser/_parser.py",
 line 719, in _parse
       l = _timelex.split(timestr)         # Splits the timestr into tokens
     File 
"/root/.virtualenvs/superset/lib/python3.8/site-packages/dateutil/parser/_parser.py",
 line 201, in split
       return list(cls(s))
     File 
"/root/.virtualenvs/superset/lib/python3.8/site-packages/dateutil/parser/_parser.py",
 line 69, in __init__
       raise TypeError('Parser must be a string or character stream, not '
   TypeError: Parser must be a string or character stream, not datetime
   ```
   
   My superset config:
   ```python
   REDIS_HOST = "172.xx.xx.xx"
   REDIS_PORT = "6379"
   
   class CeleryConfig:  # pylint: disable=too-few-public-methods
       broker_url = 'redis://%s:%s/0' % (REDIS_HOST, REDIS_PORT)
       imports = ('superset.sql_lab', "superset.tasks", 
"superset.tasks.thumbnails", )
       result_backend = 'redis://%s:%s/0' % (REDIS_HOST, REDIS_PORT)
       worker_log_level = 'DEBUG'
       worker_prefetch_multiplier = 10
       task_acks_late = True
       task_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,
           },
       }
       beat_schedule = {
           'reports.scheduler': {
               'task': 'reports.scheduler',
               'schedule': crontab(minute='*', hour='*'),
           },
           'reports.prune_log': {
               'task': 'reports.prune_log',
               'schedule': crontab(minute=0, hour=0),
           },
       }
   
   ```
   
   
   Activating my celery command
   
   ```shell
   nohup /root/.virtualenvs/superset/bin/celery 
--app=superset.tasks.celery_app:app worker --pool=prefork -O fair -c 4 > 
/root/log/celery_worker_log.log 2>&1&
   nohup /root/.virtualenvs/superset/bin/celery 
--app=superset.tasks.celery_app:app beat > /root/log/celery_beat_log.log 2>&1&
   nohup /root/.virtualenvs/superset/bin/celery 
--broker=redis://172.xx.xx.xx:6379/0 flower > /root/log/flower_log.log 2>&1&
   ```


-- 
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]

Reply via email to