django-rq

the proper way to run django rq in docker microservices setup

徘徊边缘 提交于 2019-12-11 06:34:23
问题 I have somehow bad setup of my docker containers I guess. Because each time I run task from django I see in docker container output of ps aux that there is new process created of python mange.py rqworker mail instead of using the existing one. See the screencast: https://imgur.com/a/HxUjzJ5 the process executed from command in my docker compose for rq worker container looks like this. #!/bin/sh -e wait-for-it for KEY in $(redis-cli -h $REDIS_HOST -n 2 KEYS "rq:worker*"); do redis-cli -h

Django-RQ: How to call function?

无人久伴 提交于 2019-12-07 19:14:14
问题 I am migrating a project to Django and like to use the django-rq module. However, I am stuck at what to put here: import django_rq queue = django_rq.get_queue('high') queue.enqueue(func, foo, bar=baz) How to call func ? Can this be a string like path.file.function ? Does the function need to reside in the same file? 回答1: Create tasks.py file to include from django_rq import job @job("high", timeout=600) # timeout is optional def your_func(): pass # do some logic and then in your code import

Django-RQ: How to call function?

有些话、适合烂在心里 提交于 2019-12-06 11:31:29
I am migrating a project to Django and like to use the django-rq module. However, I am stuck at what to put here: import django_rq queue = django_rq.get_queue('high') queue.enqueue(func, foo, bar=baz) How to call func ? Can this be a string like path.file.function ? Does the function need to reside in the same file? Create tasks.py file to include from django_rq import job @job("high", timeout=600) # timeout is optional def your_func(): pass # do some logic and then in your code import django_rq from tasks import your_func queue = django_rq.get_queue('high') queue.enqueue(your_func, foo, bar