Code review comment for lp:~abentley/launchpad/ampoulejob-timeout

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

= 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
timeout, so move acquireLease to JobRunner.runAll and
TwistedJobRunner.runJobInSubprocess.

Extract most of the bootstrap code to lp.services.job.runner.bootstrap()

== Tests ==
bin/test -t update_preview_diffs -t test_runner

== Demo and Q/A ==
None, really. We don't have any jobs that exceed timeouts at present.

« Back to merge proposal