RQ-dashboard сообщает данные о пустом времени - PullRequest
2 голосов
/ 30 мая 2020

Я пытаюсь построить очередь заданий с Redis Queue и RQ-scheduler. Но из RQ-панели я получаю следующую ошибку, когда пытаюсь загрузить вкладку заданий. Я вижу, что вакансии добавляются, потому что их количество растет.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, 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 428, in list_jobs
    queue_name, registry_name, offset, per_page
  File "/rq_dashboard/web.py", line 233, in get_queue_registry_jobs_count
    current_queue_jobs = [queue.fetch_job(job_id) for job_id in job_ids]
  File "/rq_dashboard/web.py", line 233, in <listcomp>
    current_queue_jobs = [queue.fetch_job(job_id) for job_id in job_ids]
  File "/usr/local/lib/python3.7/site-packages/rq/queue.py", line 147, in fetch_job
    job = self.job_class.fetch(job_id, connection=self.connection)
  File "/usr/local/lib/python3.7/site-packages/rq/job.py", line 299, in fetch
    job.refresh()
  File "/usr/local/lib/python3.7/site-packages/rq/job.py", line 506, in refresh
    self.restore(data)
  File "/usr/local/lib/python3.7/site-packages/rq/job.py", line 474, in restore
    self.started_at = str_to_date(obj.get('started_at'))
  File "/usr/local/lib/python3.7/site-packages/rq/utils.py", line 256, in str_to_date
    return utcparse(as_text(date_str))
  File "/usr/local/lib/python3.7/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.7/_strptime.py", line 577, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/local/lib/python3.7/_strptime.py", line 359, in _strptime
    (data_string, format))
ValueError: time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'
23:48:49: Exception on /0/data/jobs/default/queued/8/1.json [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/rq/utils.py", line 169, in utcparse
    return datetime.datetime.strptime(string, _TIMESTAMP_FORMAT)
  File "/usr/local/lib/python3.7/_strptime.py", line 577, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/local/lib/python3.7/_strptime.py", line 359, in _strptime
    (data_string, format))
ValueError: time data '' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'

Я добавляю вакансии следующим образом:

from redis import Redis
from rq import Queue
from rq_scheduler import Scheduler
from datetime import datetime
import functions

tables = [["materialen", 2260, "artikelcode"], ["contracten", 4200, "contractnummer"], ["klantgegevens", 101, "klantnummer"], ["servicebonnen", 3600, "servicebonnummer"], [
    "contactpersonen", 105, "klantnummer"], ["archief", 3900, "servicebonnummer"], ["documenten", 4240, "volgnummer"], ["memos", 3609, "servicebonnummer"]]

# Get a scheduler for the "default" queue
scheduler = Scheduler(connection=Redis('127.0.0.1'))

for tableInfo in tables:
    scheduler.schedule(
        scheduled_time=datetime.utcnow(),
        timeout=120,
        description=tableInfo[0],
        func=functions.updateTable,
        args=[tableInfo],
        interval=60,
        repeat=None,
    )

Я не могу понять, что я делаешь неправильно? Какая переменная пуста или я неправильно выставил запланированное время?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...