Added a missing import (for debug flag on error only).
Multiprocessing for job submission, event handlers, poll & kill.
Tidy suite shutdown; Exit 1 on scheduler abort.
Test suite fixes for cleaner suite shutdown.

Fix task events test. Corrected a shutdown test reference log.
Fixed database test.  Comparison of db events with the reference version
was failing on this branch entirely due to a difference in event
ordering because "order by name, message" is ambiguous when only a few
events recorded messages. Default ordering works on this branch and master.
Fixed the state-dump tests and one restart test: On this branch we exit
from main loop immediately on shutdown instead of going through the main
loop once more (or partially) leading to minor state differences at
shutdown (e.g. ready vs waiting on shutdown - the former triggers
immediately on restart; the latter only after prereqs are satisfied).