Move the _pformat() method to be a classmethod

To avoid creating nested functions when a class one
will suffice just switch to using a class method for
the nested _pformat() function instead.

This also makes sure that the cause of a exception is
not none before attempting to format it (and its
children) and also passes along a lines list that is
appended/extended instead of each function call creating
its own version which is later merged.

Change-Id: Ie84b004c115e488c87f9829bfcf4d8f66ebb660f
Use a module level constant to provide the DEFAULT_LISTEN_FOR

Instead of repeating the same tuple over and over again just
provide a module level constant in the listener base module that
defines the default listen_for tuple that is then used in all
subclasses as the default (if those subclasses support forwarding
the listen_for states in the first place).

This makes it so that users of listeners can more easily figure
out the default to pass, without having to get involved in the
inner details.

Change-Id: I3041db4d7eabfbe8d0b2cc267cfca0e46c0b7139
Add a claims listener that connects job claims to engines

To make it easily possible to stop running a engine that was
created from a job, add a claims listener that will be called
on state changes that an engine progresses through. During those
state changes the jobboard will be queried to determine if the
job is still claimed by the respective owner; if not the engine
will be suspended and further work will stop.

Change-Id: I8bbc6a3e03746ba0a7c74139cf9e230631d80d8f
Merge "Move the _pformat() method to be a classmethod"
Merge "Add a claims listener that connects job claims to engines"
Merge "Use a module level constant to provide the DEFAULT_LISTEN_FOR"