Merge lp:~adeuring/launchpad/lp-lazr.jobrunner into lp:launchpad
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Aaron Bentley on 2012-03-28 | ||||
| Approved revision: | no longer in the source branch. | ||||
| Merged at revision: | 15037 | ||||
| Proposed branch: | lp:~adeuring/launchpad/lp-lazr.jobrunner | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
606 lines (+98/-136) 15 files modified
lib/lp/code/scripts/tests/test_create_merge_proposals.py (+3/-3) lib/lp/code/scripts/tests/test_merge_proposal_jobs.py (+2/-1) lib/lp/code/scripts/tests/test_reclaim_branch_space.py (+7/-5) lib/lp/code/scripts/tests/test_sendbranchmail.py (+12/-7) lib/lp/registry/tests/test_process_job_sources_cronjob.py (+2/-2) lib/lp/services/job/interfaces/job.py (+3/-6) lib/lp/services/job/model/job.py (+28/-5) lib/lp/services/job/runner.py (+17/-89) lib/lp/services/job/tests/test_runner.py (+11/-12) lib/lp/soyuz/model/packagecopyjob.py (+1/-1) lib/lp/soyuz/tests/test_packagecopyjob.py (+1/-1) lib/lp/testing/factory.py (+1/-1) lib/lp/translations/scripts/tests/test_packaging_translations.py (+2/-2) setup.py (+1/-0) versions.cfg (+7/-1) |
||||
| To merge this branch: | bzr merge lp:~adeuring/launchpad/lp-lazr.jobrunner | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Aaron Bentley (community) | 2012-03-14 | Approve on 2012-03-28 | |
| Abel Deuring (community) | Resubmit on 2012-03-28 | ||
|
Review via email:
|
|||
Commit Message
use lazr.jobrunner for basic job management
Description of the Change
This branch removes some core methods from class JobRunner, which
are now provided by lazr.jobrunner.
It requires lp:~adeuring/launchpad/lazr.jobrunner-more-tests (not yet
merged into lp:lazr.jobrunner/trunk)
lazr.jobrunner does not do everything which the old job runner did.
Most notably, the now removed method BaseJobRunner.
several calls of transaction.
The new module lazr.jobrunner does make any assumption where or how
the status of a job is stored, or if a job makes any other changes
to a database, and hence does do any of these calls.
Instead, these calls are now done in Job.start(), Job.complete() etc.
Grepping through the Launchpad source code showed that some of these
methods are called in places that are not related to controlling a
job, but for example to create a job in the status "suspended".
Calling transaction.
"intermediate" commits; to avoid this, I added the parameter
manage_transaction to Job.start() etc, which is False by default,
but the calls in lazr.jobrunner use manage_
is somewhat ugly, but the alternative, keeping transaction management
in lazr.jobrunner, would also look odd: The module is supposed to do
job management, regardless of any possible database related activities
of a job.
test: ./bin/test -vvt lp.services.job
no lint
| Abel Deuring (adeuring) wrote : | # |
> Not landable yet because it assumes lazr.jobrunner is a development egg.
> "../lazr.jobrunner" should not be listed in buildout.cfg, and a version
> of lazr.jobrunner should be specified in versions.cfg.
Done.
>
> runJob may not need to be overridden in BaseJobRunner. If not, please
> remove it.
I think that we should keep this method: class runner.
implements some required methods like notifyOops(), but it does not
implement start(), complete() etc. The latter methods are defined in
lp.services.
lazr.jobrunner.
def runJob(self, job):
in BaseJobRunner ensures that the Zope machinery adapts the "incomplete"
job to IRunnableJob. OK, IRunnableJob(job) is also called in
JobRunner.runAll() and in TwistedJobRunne
right now not strictly necessary in JobRunner.runJob() -- but keeping
JobRunner.runJob() makes it easier to remove runAll() later.
Alternatively, we could call IRunnableJob(job) in lazr.jobrunner, but I
am not sure if this makes sense.
> job_str may not need to be overridden in BaseJobRunner. If not, please
> remove it.
Right, this is no longer needed. Removed.
| Aaron Bentley (abentley) wrote : | # |
> > runJob may not need to be overridden in BaseJobRunner. If not, please
> > remove it.
>
> I think that we should keep this method: class runner.
> implements some required methods like notifyOops(), but it does not
> implement start(), complete() etc. The latter methods are defined in
> lp.services.
> lazr.jobrunner.
>
> def runJob(self, job):
> super(BaseJobRu
>
> in BaseJobRunner ensures that the Zope machinery adapts the "incomplete"
> job to IRunnableJob. OK, IRunnableJob(job) is also called in
> JobRunner.runAll() and in TwistedJobRunne
> right now not strictly necessary in JobRunner.runJob() -- but keeping
> JobRunner.runJob() makes it easier to remove runAll() later.
I think this is fine for now. In the future, I think we might want to make the job source responsible for ensuring that the job is runnable, and have the runner assume the job is runnable.
> Alternatively, we could call IRunnableJob(job) in lazr.jobrunner, but I
> am not sure if this makes sense.
I'd like to keep zope.component out of lazr.jobrunner if we can.
| Abel Deuring (adeuring) wrote : | # |
Some additional changes are necessary to use lazr.jobrunner (see also https:/
The change in lib/lp/
The second change: I added the method Job._doOops() again to BasJobRunner. The reason:
The implementation of _doOops() in lazr.jobrunner calls oops_report.
This conflicts with the way how Launchpad generates an OOPS in scripts: lp.services.
tests:
bin/test -vv \
-t lp.registry.
-t lp.registry.
-t lp.code.
-t lp.code.
-t lp.code.
-t lp.translations
-t lp.registry.
no lint
| Aaron Bentley (abentley) wrote : | # |
I believe this would introduce a regression with database error handling. If there is a database error (like a permission failure) runJobHandleError will call Job.fail. But that will cause a database lookup. Which fails due to the previous error. e.g. http://
| Abel Deuring (adeuring) wrote : | # |
The problem you mentioned is fixed in lazr.jobrunner (including tests).

Not landable yet because it assumes lazr.jobrunner is a development egg. "../lazr.jobrunner" should not be listed in buildout.cfg, and a version of lazr.jobrunner should be specified in versions.cfg.
runJob may not need to be overridden in BaseJobRunner. If not, please remove it.
job_str may not need to be overridden in BaseJobRunner. If not, please remove it.