Parallels / rq-dashboard

Flask-based web front-end for monitoring RQ queues
http://python-rq.org/
Other
1.45k stars 328 forks source link

ValueError: time data '' does not match format '%Y-%m-%dT%H:%M:%SZ' #362

Open petlack opened 4 years ago

petlack commented 4 years ago

When running rq-dashboard in the latest docker container with

docker run -p 9181:9181 eoranged/rq-dashboard:v0.6.3

the Workers page cannot load list of workers.

Logs:

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/rq_dashboard/web.py", line 101, in _wrapped
    result_dict = f(*args, **kwargs)
  File "/rq_dashboard/web.py", line 535, in list_workers
    workers = sorted(
  File "/rq_dashboard/web.py", line 541, in <genexpr>
    current_job=serialize_current_job(worker.get_current_job()),
  File "/usr/local/lib/python3.8/site-packages/rq/worker.py", line 363, in get_current_job
    return self.job_class.fetch(job_id, self.connection)
  File "/usr/local/lib/python3.8/site-packages/rq/job.py", line 303, in fetch
    job.refresh()
  File "/usr/local/lib/python3.8/site-packages/rq/job.py", line 515, in refresh
    self.restore(data)
  File "/usr/local/lib/python3.8/site-packages/rq/job.py", line 479, in restore
    self.ended_at = str_to_date(obj.get('ended_at'))
  File "/usr/local/lib/python3.8/site-packages/rq/utils.py", line 256, in str_to_date
    return utcparse(as_text(date_str))
  File "/usr/local/lib/python3.8/site-packages/rq/utils.py", line 172, in utcparse
    return datetime.datetime.strptime(string, '%Y-%m-%dT%H:%M:%SZ')
  File "/usr/local/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/local/lib/python3.8/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'
BartlomiejSkwira commented 4 years ago

I'm experiencing the same issue using current latest docker image from eoranged/rq-dashboard:latest. I get this: ValueError: time data '' does not match format '%Y-%m-%dT%H:%M:%SZ

I tried clearing all jobs from queues but it seems it didn't help.  

BartlomiejSkwira commented 4 years ago

Visually in the dashboard this looks like this for me:

  1. Failed jobs image

  2. Click on the failed jobs - the "Loading" is displayed all the time, but failed jobs don't appear due to 500 Internal server error which you can see in the developer tools Network tab. image

(*Clicking "Empty queue" doesn't do anything.)

jmandt commented 4 years ago

@BartlomiejSkwira We experience the exact same problem. Whenever a job is executed, every queue/list only shows "Loading..." and failed jobs are not shown at all.

jmandt commented 4 years ago

@BartlomiejSkwira We solved the problem by using eoranged/rq-dashboard:latest and manually installed the newest rq version in the container. This solves the problem and everything is working fine now. Our Dockerfile looks like this now:

FROM eoranged/rq-dashboard:latest

RUN pip install rq==1.5.2
pypeaday commented 3 years ago

Holy crud thank you for this... I've been pulling my hair out trying to get a python-rq workflow going (due to other python requirements it's far from trivial) but this error was driving me crazy... The custom dockerfile fix is easy so thanks!

fakegermano commented 3 years ago

Yeah, the current requirements.txt for the project fixes rq to 1.3, but there were changes on 1.5 that broke datetimes.

props to @jmandt for finding the fix

ill try and make a PR to update the rq version, should fix this for people that install the package as well as use the docker image

anton-petrov commented 3 years ago
  1. Create Dockerfile

    FROM eoranged/rq-dashboard:latest
    RUN pip install rq==1.8.1
  2. Run from terminal docker build -t rq-dashboard:latest .

  3. Enjoy :)

  4. If you need docker-compose.yml

    my_rq_dashboard:
    image: rq-dashboard:latest
    environment:
      - RQ_DASHBOARD_REDIS_URL=redis://my_redis:6379
      - RQ_DASHBOARD_USERNAME=rq
      - RQ_DASHBOARD_PASSWORD=rq
    ports:
      - "10000:9181"
    depends_on:
      - my_redis
    links:
      - my_redis 
essamgouda97 commented 1 year ago

Can confirm, issue was fixed by updating rq !

zak427zak commented 1 month ago

If you still see this issue, try using the latest version of rq-dashboard (0.8, not 0.6) from cjlapao/rq-dashboard:latest