Celery, Django .. creating a subtask / thread to launch a task / thread?

I am using celery with django and trying to get Task as shown below:

class task1 (Task)
   def run (self):
      launch_some_other_task.delay()

But it doesnโ€™t seem to work, I can dwell on my code in more detail, but I decided that first I would ask if it would work, as if it did not work for me. I find this necessary because I use selenium, a web testing platform where sometimes it just hangs, where I canโ€™t get any result from this, so I want to be able to kill if off, if a certain condition not performed (updating the memcache variable with a specific value for a certain number of seconds).

Thanks for any advice on this.

+3
source share
1 answer

Make sure you add the following to yours urls.py:

import djcelery
djcelery.setup_loader()
0
source

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


All Articles