> Hello!
>
> I have a task which calls a subtask which calls another subtask and so on. I would like to be able to query the main task and find out which sub task is currently running.
>
> Let me make it clear with an example. This is the example straight from Celery documentation.
>
> Now when I call the update_page_info task, and check its state, I would like to be able to get custom states like FETCHING, PARSING, STORING, etc. depending on which subtask is processing currently. I tried looking up in multiple places, but it was not clear how to accomplish this.
You should have the tasks return the AsyncResult/TaskSetResult of the subtasks they start,
that way you can traverse the subsequent tasks.
One example is AsyncResult.collect, which is a new method only available in the development
version: https://github.com/ask/celery/blob/master/celery/result.py#L98-140
This will also work with the stable and older versions.
--
Ask Solem
twitter.com/asksol | +44 (0)7713357179