Overview

Summary

A simple hack that can turn out to be useful someday. (For use with python twisted)

It strives to make twisted debugging easy.

For now it can:

  1. track deferred creation
  2. track when call/errback is attached to the deferred
  3. track when call/errback has executed or failed to execute
  4. track when a deferred is chained to another deferred

Example

Note

The following is just a summary. The real thing is hosted at https://reactor-track-documentation.readthedocs.org/ (or if you are a real man, build it yourself in doc/)

Let's look at example.py - We first create a json monitor which means that when we receive an event like deferredTracked json output with the event is appended to buffer which we could write to a file.

After that call track on objects of interest:

monitor.track(d)
f = open("mon.out", "w")

for line in monitor.buffer:
f.write("{0}\n".format(line))

f.close()

Write everything to a file after reactor shuts down.

  1. Run python example.py (Kill it with Ctrl+C or something) This will create the file mon.out.
  2. After which run cat mon.out | python reactortrack/monitor2model.py - This will produce a squaremap representation of the deferred.
  3. Finally traverse line-by-line the events with Debug->Next line or CTRL+N