Merge lp:~sinzui/launchpad/queue-project-email into lp:launchpad

Proposed by Curtis Hovey on 2012-05-31
Status: Merged
Approved by: j.c.sackett on 2012-05-31
Approved revision: no longer in the source branch.
Merged at revision: 15349
Proposed branch: lp:~sinzui/launchpad/queue-project-email
Merge into: lp:launchpad
Diff against target: 0 lines
To merge this branch: bzr merge lp:~sinzui/launchpad/queue-project-email
Reviewer Review Type Date Requested Status
j.c.sackett (community) 2012-05-31 Approve on 2012-05-31
Review via email: mp+108235@code.launchpad.net

Commit Message

Create daily project licensing emails.

Description of the Change

Pre-implementation: abentley, wgrant

Launchpad needs a daily process that queues the jobs to send emails
about expiring commercial licenses.

--------------------------------------------------------------------

RULES

    * Using daily-builds as a guide
      * Create a cronscript that gets each kind of product job source
      * It calls each job source to make the needed jobs.
      * Maybe the job sources need to be called in a specific order.

QA

    * Verify database/schema/security.py --no-revoke was run to
      add the commercialsubscription table to the product-job user.
    * Ask a WebOps to run ./cronscripts/daily_product_jobs.py -vvv
    * Verify that the script reports that 14 or more jobs were created.
    * Verify that a ThirtyDay... job were created for numerink.
    * Verify that an Expired... job were created for sausalito.
    * Verify that sausalito is deactivated.

LINT

    cronscripts/daily_product_jobs.py
    database/schema/security.cfg
    lib/lp/registry/interfaces/productjob.py
    lib/lp/registry/model/productjob.py
    lib/lp/registry/tests/test_productjob.py
    lib/lp/services/config/schema-lazr.conf

TEST

    ./bin/test -vvc lp.registry.tests.test_productjob

IMPLEMENTATION

Created a cronscript that calls ProductJobManager.createAllDailyJobs().
I discovered that I neglected to add the product-job user to the config.
The queries to find expiring products needed access to the
commercialsubscription which I added via security.cfg.
    cronscripts/daily_product_jobs.py
    database/schema/security.cfg
    lib/lp/services/config/schema-lazr.conf

I extracted the create() method from the three commercial job sources to
a base interface and added getExpiringProducts(). The ProductJobManager
requires that all the commercial jobs to have the same contracts.
    lib/lp/registry/interfaces/productjob.py

I added the ProductJobManager to orchestra job creation. This will grow
to handle "other/open source" and "other/I don't know" cases in the
future. ProductJobManager does the primary work for the cronscript. I
added getExpiringProducts() to the mixin class used by the commercial
jobs, then updated each class to provide _get_expiration_dates() that
returns the set of dates that constrain the search. In the tests I add
CommercialHelpers which is used by old and new tests to ensure the job
classes, the manager, and the cronscript has a common setup to ensure
they operate under the same conditions.
    lib/lp/registry/model/productjob.py
    lib/lp/registry/tests/test_productjob.py

To post a comment you must log in.
j.c.sackett (jcsackett) wrote :

Curtis--

This looks good. Thanks.

review: Approve

Preview Diff

Empty