Merge lp:~allenap/launchpad/twisted-threading-bug-491870 into lp:launchpad
| Status: | Rejected |
|---|---|
| Rejected by: | Gavin Panella on 2010-03-15 |
| Proposed branch: | lp:~allenap/launchpad/twisted-threading-bug-491870 |
| Merge into: | lp:launchpad |
| Diff against target: |
822 lines (+469/-158) 9 files modified
lib/lp/bugs/doc/checkwatches-cli-switches.txt (+1/-1) lib/lp/bugs/doc/externalbugtracker.txt (+0/-107) lib/lp/bugs/scripts/checkwatches.py (+88/-32) lib/lp/bugs/scripts/tests/test_checkwatches.py (+175/-3) lib/lp/scripts/utilities/importfascist.py (+1/-0) lib/lp/services/job/runner.py (+3/-2) lib/lp/services/job/tests/test_runner.py (+15/-13) lib/lp/testing/__init__.py (+55/-0) lib/lp/testing/tests/test_zope_test_in_subprocess.py (+131/-0) |
| To merge this branch: | bzr merge lp:~allenap/launchpad/twisted-threading-bug-491870 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Henning Eggers (community) | code | 2010-02-08 | Approve on 2010-02-08 |
|
Review via email:
|
|||
Commit Message
In checkwatches, use Twisted to manage threading instead of the threading module.
| Gavin Panella (allenap) wrote : | # |
| Henning Eggers (henninge) wrote : | # |
Thanks for this improvement!
We talked about some things on IRC:
- Use of lambda is against LP coding style but common in Twisted. We will raise the issue at the reviewers meeting and you can leave it as it is for now. If the style change gets rejected, I ask you to fix this in a follow-up branch. Or wait until after the meeting before landing.
- The intended use of install_
- You agreed to add an explicit test for SerialScheduler.
Thanks for your patience with me ... ;-)
| Jonathan Lange (jml) wrote : | # |
On Mon, Feb 8, 2010 at 5:38 PM, Henning Eggers
<email address hidden> wrote:
> Review: Approve code
> Thanks for this improvement!
>
> We talked about some things on IRC:
> - Use of lambda is against LP coding style but common in Twisted. We will raise the issue at the reviewers meeting and you can leave it as it is for now. If the style change gets rejected, I ask you to fix this in a follow-up branch. Or wait until after the meeting before landing.
FWIW, if the reviewers decree that lambda is too hard to read, then
it's probably worth defining a function like this:
def kerchop(f):
def callback(ignored, *args, **kwargs):
return f(*args, **kwargs)
return mergeFunctionMe
And then replacing:
d.addCallback
with:
d.addCallback
The function ought to go somewhere in lp.services, and have a better
name than 'kerchop'.
jml
| Gavin Panella (allenap) wrote : | # |
Hi Henning,
Thank you for the review. I added some more info about install_
I also switched to using the default reactor thread pool instead of creating my own in TwistedThreadSc
* We're calling reactor.run(). It's ours, we're not sharing it, so no harm in just using its thread pool.
* The import fascist was complaining about importing deferToThreadPool. Maybe this should be in its module's __all__, maybe not. I'll file a bug for that.
Incremental diff: http://
Thanks, Gavin.
| Gavin Panella (allenap) wrote : | # |
> The import fascist was complaining about importing
> deferToThreadPool. Maybe this should be in its module's
> __all__, maybe not. I'll file a bug for that.
| Jonathan Lange (jml) wrote : | # |
The fascist has a place where you can disable the warning: lib/lp/
| Gavin Panella (allenap) wrote : | # |
Okay, I'm flip-flopping on this. Back To The Threadpool.

checkwatches can update bug watches for different remote trackers in parallel. Currently that's implemented using threads via the threading module. This branch continues to use threads, but does so with a Twisted ThreadPool.
To make testing easier, and to make the design more elegant, it's possible to pass in a scheduler to BugWatchUpdate. updateBugTracke rs(). Previously the scheduling policy was baked into this method.
Getting Twisted in there also opens the door for using more async code in the future.