You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "sxfang32 (via GitHub)" <gi...@apache.org> on 2023/07/20 06:01:35 UTC

[GitHub] [superset] sxfang32 opened a new issue, #24750: TypeError('Parser must be a string or character stream, not datetime')

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: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] kizzlota commented on issue #24750: TypeError('Parser must be a string or character stream, not datetime')

Posted by "kizzlota (via GitHub)" <gi...@apache.org>.
kizzlota commented on issue #24750:
URL: https://github.com/apache/superset/issues/24750#issuecomment-1655752208

   +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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] HeathLee commented on issue #24750: TypeError('Parser must be a string or character stream, not datetime')

Posted by "HeathLee (via GitHub)" <gi...@apache.org>.
HeathLee commented on issue #24750:
URL: https://github.com/apache/superset/issues/24750#issuecomment-1655130791

   +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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sxfang32 commented on issue #24750: TypeError('Parser must be a string or character stream, not datetime')

Posted by "sxfang32 (via GitHub)" <gi...@apache.org>.
sxfang32 commented on issue #24750:
URL: https://github.com/apache/superset/issues/24750#issuecomment-1659462366

   ```shell
   superset/tasks/scheduler.py
   ```
   
   ```python
   def execute(report_schedule_id: int, scheduled_dttm: str) -> None:
       task_id = None
       try:
           task_id = execute.request.id
           # scheduled_dttm_ = parser.parse(scheduled_dttm)
           scheduled_dttm_ = parser.parse(str(scheduled_dttm))
           AsyncExecuteReportScheduleCommand(
               task_id,
               report_schedule_id,
               scheduled_dttm_,
           ).run()
       except ReportScheduleUnexpectedError:
           logger.exception(
               "An unexpected occurred while executing the report: %s", task_id
           )
       except CommandException:
           logger.exception(
               "A downstream exception occurred while generating" " a report: %s", task_id
           )
   ```


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sxfang32 commented on issue #24750: TypeError('Parser must be a string or character stream, not datetime')

Posted by "sxfang32 (via GitHub)" <gi...@apache.org>.
sxfang32 commented on issue #24750:
URL: https://github.com/apache/superset/issues/24750#issuecomment-1659463065

   > +1
   
   superset/tasks/scheduler.py
   ```python
   def execute(report_schedule_id: int, scheduled_dttm: str) -> None:
       task_id = None
       try:
           task_id = execute.request.id
           # scheduled_dttm_ = parser.parse(scheduled_dttm)
           scheduled_dttm_ = parser.parse(str(scheduled_dttm))
           AsyncExecuteReportScheduleCommand(
               task_id,
               report_schedule_id,
               scheduled_dttm_,
           ).run()
       except ReportScheduleUnexpectedError:
           logger.exception(
               "An unexpected occurred while executing the report: %s", task_id
           )
       except CommandException:
           logger.exception(
               "A downstream exception occurred while generating" " a report: %s", task_id
           )
   ```


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sxfang32 commented on issue #24750: TypeError('Parser must be a string or character stream, not datetime')

Posted by "sxfang32 (via GitHub)" <gi...@apache.org>.
sxfang32 commented on issue #24750:
URL: https://github.com/apache/superset/issues/24750#issuecomment-1659462981

   > +1
   
   superset/tasks/scheduler.py
   ```python
   def execute(report_schedule_id: int, scheduled_dttm: str) -> None:
       task_id = None
       try:
           task_id = execute.request.id
           # scheduled_dttm_ = parser.parse(scheduled_dttm)
           scheduled_dttm_ = parser.parse(str(scheduled_dttm))
           AsyncExecuteReportScheduleCommand(
               task_id,
               report_schedule_id,
               scheduled_dttm_,
           ).run()
       except ReportScheduleUnexpectedError:
           logger.exception(
               "An unexpected occurred while executing the report: %s", task_id
           )
       except CommandException:
           logger.exception(
               "A downstream exception occurred while generating" " a report: %s", task_id
           )
   ```


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] TypeError('Parser must be a string or character stream, not datetime') [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #24750:
URL: https://github.com/apache/superset/issues/24750#issuecomment-1986215050

   Hi. I'm not sure if this is still an issue, or what you're intending to say with the code snippet in the comments. If that's a modification that fixes the issue, I'd suggest you open a PR. This version of Superset is no longer supported, so I'll close this issue. If anyone is still encountering this in current versions (3.x) please open a new Issue  with updated context or let me know if this issue needs a revisit. 


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] TypeError('Parser must be a string or character stream, not datetime') [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #24750: TypeError('Parser must be a string or character stream, not datetime')
URL: https://github.com/apache/superset/issues/24750


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org