Code review comment for lp:~abentley/launchpad/twistedjob

Revision history for this message
Aaron Bentley (abentley) wrote :

= Summary =
Provide a way of running jobs through Twisted

== Proposed fix ==
Provide a TwistedJobRunner, and adjust related interfaces.

== Pre-implementation notes ==
Preimplementation was with thumper.

== Implementation details ==
Extract BaseJobRunner from JobRunner. Extract runJobHandleError from
runAll.

Implement TwistedJobRunner, derived from BaseJobRunner. Use the task support
classes to implement support for running jobs via Twisted. Specifically,
Provide a PollingTaskSource that returns a lambda to call runJobHandleError.
Use the ParallelLimitedTaskConsumer to consume these tasks.

Implement runAll in terms of ParallelLimitedTaskConsumer. Note that, at this
time, this does not cause parallelism, because ParallelLimitedTaskConsumer is
parameterized to run 1 task at a time.

Implement JobRunner.runFromSource method, because this can be polymophic.
Adjust JobCronScript to take a runner_class, so that it can optionally use
Twisted.

Change update_prefiew_diffs to run under Twisted if the --twisted option is
supplied.

== Tests ==
bin/test -t update_preview_diffs

== Demo and Q/A ==
Have the LOSAs change the staging cron script to run update_preview_diffs with
--twisted. Cause a preview diff to be generated. Examine the log, and see
that it ran under Twisted.

« Back to merge proposal