Merge lp:~abentley/launchpad/ampoulejob-timeout into lp:launchpad
Proposed by
Aaron Bentley
Status: | Merged |
---|---|
Approved by: | Aaron Bentley |
Approved revision: | not available |
Merged at revision: | not available |
Proposed branch: | lp:~abentley/launchpad/ampoulejob-timeout |
Merge into: | lp:launchpad |
Prerequisite: | lp:~abentley/launchpad/ampoulejob |
Diff against target: |
358 lines (+155/-40) 6 files modified
lib/lp/code/scripts/tests/test_update_preview_diffs.py (+5/-1) lib/lp/services/job/runner.py (+67/-31) lib/lp/services/job/tests/test_runner.py (+69/-2) lib/lp/translations/scripts/po_import.py (+4/-1) lib/lp/translations/scripts/tests/test_translations_import.py (+9/-0) versions.cfg (+1/-5) |
To merge this branch: | bzr merge lp:~abentley/launchpad/ampoulejob-timeout |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paul Hummer (community) | Approve | ||
Review via email: mp+15986@code.launchpad.net |
To post a comment you must log in.
= Summary =
Enforce timeouts for jobs running under Twisted.
== Proposed fix ==
Use Ampoule's timeout handling.
== Pre-implementation notes ==
This was discussed a bit with mwhudson.
== Implementation details ==
Use Job.getTimeout to determine the job's timeout and run it with that timeout.
Ideally, timeouts should cause the subprocess to oops, so subclass ProcessPool
as HUPProcessPool, and override _handleTimeout to use HUP instead. Install a
signal handler for HUP in the child process that raises TimeoutError.
The lease must be acquired before the job is run in order to determine the r.runJobInSubpr ocess.
timeout, so move acquireLease to JobRunner.runAll and
TwistedJobRunne
Extract most of the bootstrap code to lp.services. job.runner. bootstrap( )
== Tests == preview_ diffs -t test_runner
bin/test -t update_
== Demo and Q/A ==
None, really. We don't have any jobs that exceed timeouts at present.