[英]ValueError: time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'
I am trying to run rq worker in ubuntu but when I type我正在尝试在 ubuntu 中运行 rq worker 但是当我输入
rq worker
It gives me this error它给了我这个错误
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/rq/utils.py", line 169, in utcparse
return datetime.datetime.strptime(string, _TIMESTAMP_FORMAT)
File "/usr/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/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:%S.%fZ'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/rq/worker.py", line 508, in work
result = self.dequeue_job_and_maintain_ttl(timeout)
File "/usr/lib/python3/dist-packages/rq/worker.py", line 574, in dequeue_job_and_maintain_ttl
result = self.queue_class.dequeue_any(self.queues, timeout,
File "/usr/lib/python3/dist-packages/rq/queue.py", line 539, in dequeue_any
job = job_class.fetch(job_id, connection=connection)
File "/usr/lib/python3/dist-packages/rq/job.py", line 303, in fetch
job.refresh()
File "/usr/lib/python3/dist-packages/rq/job.py", line 515, in refresh
self.restore(data)
File "/usr/lib/python3/dist-packages/rq/job.py", line 478, in restore
self.started_at = str_to_date(obj.get('started_at'))
I am queueing a simple task from another file hello.py, the code:我正在从另一个文件 hello.py 中排队一个简单的任务,代码:
def add(x, y):
return x + y
and this is my main.py code:这是我的 main.py 代码:
from flask import Flask
from redis import Redis
from hello import add
from rq import Queue
q = Queue(connection=Redis())
app = Flask(__name__)
@app.route("/")
def hello():
q.enqueue(add, 3, 7)
return "Task enqueued"
if __name__ == "__main__":
app.run(debug=True)
It is queueing the things in redis-server but it doesn't have a worker to run things, I just want a worker running in ubuntu. And the redis-server is hosted locally.它正在对 redis-server 中的东西进行排队,但它没有工作人员来运行东西,我只想要一个工作人员在 ubuntu 中运行。并且 redis-server 在本地托管。 I checked even the task is enqueueing properly but it is showing that their are 0 workers.
我什至检查了任务是否正确排队,但显示他们是 0 个工人。 I don't know what else to write but feel free to ask anything regarding this.
我不知道还能写什么,但随时可以问任何关于这个的问题。
In the error you provided, there is no timestamp ('') being sent to rq:在您提供的错误中,没有时间戳('')被发送到 rq:
ValueError: time data '' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'
Check to see if you have a conflicting package called python-rq installed per this issue:根据这个问题检查是否安装了名为 python-rq 的冲突 package:
https://github.com/rq/rq/issues/1309 https://github.com/rq/rq/issues/1309
If not, check that your locale is set correctly in Ubuntu and the 'date' command produce the expected result.如果不是,请检查您的区域设置是否在 Ubuntu 中正确设置,并且“date”命令产生预期结果。 Next check that the Python also returns the correct date:
接下来检查 Python 是否也返回正确的日期:
import datetime;
print(datetime.datetime.now())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.