Search code examples
pythontwistedreactor

twisted reactor: priority and insights


Two simple questions about twisted reactor:

  1. Is there a way to explicitly assign a priority while scheduling a task ?

  2. Is it possible to inspect the reactor in order to list all the pending tasks?


Solution

  • No. The reactor does not implement priority-based scheduling; it just runs events in whatever order they happen to come back from your multiplexing/timing mechanism, depending on the particular reactor implementation (it's slightly different for the different ones).

    Implementing a scheduling or fair queueing API in the reactor would be an awesome addition, but it would be a non-trivial amount of work.