Code review comment for lp:~allenap/launchpad/multithreaded-checkwatches

Revision history for this message
Gavin Panella (allenap) wrote :

This branch makes checkwatches update bug trackers in multiple threads. The
watches for a specific bug tracker are updated sequentially in a single
thread, but other bug trackers may be being updated concurrently in separate
threads.

Most of the changes are refactoring of or new methods for BugWatchUpdater in
checkwatches.py:

 * The existing updateBugTracker() method was renamed to _updateBugTracker().

 * The existing exception handling and oops reporting code in
   updateBugTrackers() was moved to a new updateBugTracker() method.

 * forceUpdateAll() had some identical exception handling code which was
   replaced by a call to the new updateBugTracker() method.

 * updateBugTrackers() was eviscerated and replaced with the thread setup and
   run. It calls a new _bugTrackerUpdaters() method which generates functions
   for the threads to run, each of which will update one bug tracker. These
   functions are put into a work queue from which the threads will pull.

 * A new _interactionDecorator() method was created to support running jobs in
   an interaction. Each of the functions that _bugTrackerUpdaters() yields is
   decorated with this. This is needed because interactions are specific to a
   thread.

Other work:

 * Add a --jobs option to the checkwatches.py script.

 * Tests that called updateBugTracker() now call _updateBugTracker() to avoid
   the transaction stuff.

 * Demonstrate updateBugTrackers() spawning multiple threads.

Testing:

  bin/test -vvct 'checkwatch|externalbug'

Lint:

  lib/lp/bugs/scripts/checkwatches.py
      22: [F0401] Unable to import 'lazr.lifecycle.event' (No module named
          lifecycle)

« Back to merge proposal