ValueError: Unknown type <class 'redis.client.StrictPipeline'>

enter image description here

I am developing locally on win10, which is a problem for using the RQ task queue, which only works on Linux systems, because it requires the ability for fork processes. I am trying to expand a project based on the flask https://github.com/hack4impact/flask-base/tree/master/app , which can use RQ. I came across https://github.com/michaelbrooks/rq-win . I like the idea of ​​this repo (if I can make it work, it will really simplify my life, as I develop a gain of 10 -64):

After installing this library

I can queue the task in my views by running something like:

     @login_required
     @main.route('/selected')
     def selected():
     messages = 'abcde'
      j = get_queue().enqueue(render_png, messages, result_ttl=5000)
      return j.get_id()

job_code.

manage.py :

from rq_win import WindowsWorker

@manager.command
def run_worker():
    """Initializes a slim rq task queue."""
    listen = ['default']


    REDIS_URL = 'redis://localhost:6379'
    conn = Redis.from_url(REDIS_URL)

    with Connection(conn):
        # worker = Worker(map(Queue, listen))
        worker = WindowsWorker(map(Queue, listen))
        worker.work()

:

$ python -u manage.py run_worker 


09:40:44
09:40:44 *** Listening on ?[32mdefault?[39;49;00m...
09:40:58 ?[32mdefault?[39;49;00m: ?[34mapp.main.views.render_png('{"abcde"}')?[39;49;00m (8c1b6186-39a5-4daf-9c45-f60e4241cd1f)
...\lib\site-packages\rq\job.py:161: DeprecationWarning: job.status is deprecated. Use job.set_status() instead
  DeprecationWarning
09:40:58 ?[31mValueError: Unknown type <class 'redis.client.StrictPipeline'>?[39;49;00m
Traceback (most recent call last):
  File "...\lib\site-packages\rq_win\worker.py", line 87, in perform_job
    queue.enqueue_dependents(job, pipeline=pipeline)
  File "...\lib\site-packages\rq\queue.py", line 322, in enqueue_dependents
    for job_id in pipe.smembers(dependents_key)]
  File "...\lib\site-packages\rq\queue.py", line 322, in <listcomp>
    for job_id in pipe.smembers(dependents_key)]
  File "...\lib\site-packages\rq\compat\__init__.py", line 62, in as_text
    raise ValueError('Unknown type %r' % type(v))
ValueError: Unknown type <class 'redis.client.StrictPipeline'>

, , redis. , , . ?

+4
1

, , , , job_id as_text - - StrictPipeline. , ; ? , redis, rq rq-win , , rq.compat

+3
source

Source: https://habr.com/ru/post/1694985/


All Articles