The recursive task in celery

Using celery, I want to write a task like this:

@celery.task def add_task(): .... if(condition): add_task.apply_async(queue="default") 

I know that in python there is maximum depth when you call a recursive function. Does this restriction also apply to celery?

+4
source share
1 answer

There should be no problem with this.

However, if add_task depends on the results of the subtask, you may run into a problem when you have run out of workers, but this does not look like your small fragment. Technically, there is a limit to the number of tasks that you can queue, because ultimately you will run out of memory.

You better just try to see what happens!

+6
source

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


All Articles