Code review comment for lp:~gmb/launchpad/jobbifiy-bug-heat-calculations-509193

Revision history for this message
Graham Binns (gmb) wrote :

This branch adds the necessary interfaces and implementations to the bug
tracker to:

 a. Allow us to use the Jobs system for Bug-related tasks generally and
 b. Allow us to use the Jobs system to update bug heat specifically.

A lot of the work for the Jobs system has been cribbed from how it's
used in Codehosting, but we've pared it down to make sure that we don't
repeat stuff that's defined elsewhere. A full list of the changes we've
made is below.

We've also added a cronscript to run the CalculateBugHeatJobs.

== List of changes ==

=== cronscripts/calculate-bug-heat.py ===

 - We've added a cronscript to run pending CalculateBugHeatJobs.

=== database/schema/security.cfg ===

 - We've added permissions for the CalculateBugHeatJob runner.

=== lib/canonical/config/schema-lazr.conf ===

 - We've added config options for the CalculateBugHeatJob runner.

=== lib/lp/bugs/configure.zcml ===

 - We've added ZCML configuration for the CalculateBugHeatJobs.

=== lib/lp/bugs/interfaces/bugjob.py ===

 - We've added the following interfaces:
   - IBugJob: A base Job interface for Bugs.
   - ICalculateBugHeatJob: A base interface for bug heat calculation
     job.
   - ICalculateBugHeatJobSource: An interface for acquiring
     ICalculateBugHeatJobs.

=== lib/lp/bugs/model/bugheat.py ===

 - We've added implementation for CalculateBugHeatJob. This uses a
   BugHeatCalculator to calculate the bug heat and then calls
   Bug.setHeat() to set the bug's heat.

=== lib/lp/bugs/model/bugjob.py ===

 - We've added the following classes (cribbed largely from Codehosting):
   - BugJob: Provides a base class for all bug jobs.
   - BugJobDerived: Provides an intermediate class for deriving from
     BugJob, so that a lot of the job-generic work can be done here
     rather than others having to reproduce more boilerplate.

=== lib/lp/bugs/scripts/bugheat.py ===

 - We've added BugHeatCalculator to the __all__ for this module in order
   to fix some lint.

=== lib/lp/bugs/tests/test_bugheat.py ===

 - We've added unit tests for the CalculateBugHeatJob class.

=== lib/lp/bugs/tests/test_bugjob.py ===

 - We've added unit tests for the generic BugJob classes.

=== lib/lp/services/job/interfaces/job.py ===

 - We've added IJobSource to the __all__ for this module in order to
   fix some lint.

« Back to merge proposal