How to get all running tasks in luigi, including dynamic ones

444 Views Asked by At

I currently have a list of tasks that I run through the command

luigi.build(tasks, workers=N, local_scheduler=True, detailed_summary=True)

I would like to programmatically get the status of the local scheduler, hence I could not use global scheduler for my application. How can I get the list of running, pending, and completed tasks?

At first, I used to check for the creation of output files of some known tasks, but it is not efficient anymore since the complexity is increased and I also have dynamic tasks (yielded by some other tasks at runtime).

I noticed that I could list dependencies through:

import luigi.tools.deps
luigi.tools.deps.find_deps(my_main_task, luigi.tools.deps.upstream().family)

but it is not helping more than looking at task's output().

I have also noticed Workers having a nice _running_tasks attribute, thus I would need to get the worker and list it, but I am also wondering about what happens if I have more than 1 worker with pending tasks along with running ones.

0

There are 0 best solutions below