Merge lp:~stub/launchpad/garbo into lp:launchpad
| Status: | Merged | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Approved by: | Jeroen T. Vermeulen on 2010-04-07 | ||||||||||||
| Approved revision: | no longer in the source branch. | ||||||||||||
| Merged at revision: | not available | ||||||||||||
| Proposed branch: | lp:~stub/launchpad/garbo | ||||||||||||
| Merge into: | lp:launchpad | ||||||||||||
| Diff against target: |
192 lines (+39/-27) 2 files modified
lib/canonical/launchpad/doc/looptuner.txt (+4/-11) lib/canonical/launchpad/utilities/looptuner.py (+35/-16) |
||||||||||||
| To merge this branch: | bzr merge lp:~stub/launchpad/garbo | ||||||||||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Jeroen T. Vermeulen (community) | code | 2010-04-02 | Approve on 2010-04-07 |
|
Review via email:
|
|||
Commit Message
Let garbo tasks timeout while waiting for replication lag or long running transactions
Description of the Change
garbo-*.py lets a timeout be set for tasks so they abort if they don't complete withing a given time frame. This timeout is not checked for when blocking for long running transactions or for replication lag.
This branch fixes that. Now tasks will correctly be aborted when they timeout and report this, rather than block indefinitely.
| Stuart Bishop (stub) wrote : | # |
On Mon, Apr 5, 2010 at 7:29 PM, Jeroen T. Vermeulen <email address hidden> wrote:
> Nice to see loop tuning continue to get better. One design question: your timeout check accompanies time.sleep calls. Why not have:
>
> * An attribute flag that says "I consider myself timed out" (even if it hasn't happened yet but is bound to happen because of impending sleep)
>
> * A _checkTimeLeft(
>
> * A self.sleep method that checks for remaining time and time.sleeps only if the sleep ends before the deadline, so you don't have to check this for every time.sleep
>
> * Instead of time checks, a check for the timeout flag.
I've added a self._sleep method to simplify the 'if not timed out
sleep' stanzas.
Having a flag in addition to the check method is less clear, and we
are only doing this a few times per second so it isn't a performance
issue.
> On a more nitpicky note, _is_timed_out is not the right spelling for a method; that'd be _isTimedOut. And I don't see the point of a leading underscore in _msg_counter.
I've fixed both of these. And changed the 'extra' parameter to 'extra seconds'.
--
Stuart Bishop <email address hidden>
http://
| Jeroen T. Vermeulen (jtv) wrote : | # |
The reason I brought up an "I'm timed out" flag was concern that the tuner might decide to go straight back to work after a sleep was short-circuited because it would have timed out. But turning some "while True" loops into ones with timeout checks in the loop condition is better. Approved.

Hi Stuart,
Nice to see loop tuning continue to get better. One design question: your timeout check accompanies time.sleep calls. Why not have:
* An attribute flag that says "I consider myself timed out" (even if it hasn't happened yet but is bound to happen because of impending sleep)
* A _checkTimeLeft( seconds= 0) method that you call in various places to set the timeout flag if the requisite number of seconds isn't available
* A self.sleep method that checks for remaining time and time.sleeps only if the sleep ends before the deadline, so you don't have to check this for every time.sleep
* Instead of time checks, a check for the timeout flag.
On a more nitpicky note, _is_timed_out is not the right spelling for a method; that'd be _isTimedOut. And I don't see the point of a leading underscore in _msg_counter.
Jeroen