Merge lp:~abentley/launchpad/ampoule-0.1.1 into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Gavin Panella on 2010-02-03 |
| Approved revision: | not available |
| Merged at revision: | not available |
| Proposed branch: | lp:~abentley/launchpad/ampoule-0.1.1 |
| Merge into: | lp:launchpad |
| Diff against target: |
239 lines (+36/-69) 5 files modified
lib/lp/bugs/windmill/tests/test_bug_inline_subscriber.py (+2/-1) lib/lp/code/model/branchmergeproposaljob.py (+1/-9) lib/lp/services/job/runner.py (+30/-45) lib/lp/services/job/tests/test_runner.py (+1/-9) versions.cfg (+2/-5) |
| To merge this branch: | bzr merge lp:~abentley/launchpad/ampoule-0.1.1 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Gavin Panella (community) | 2010-02-02 | Approve on 2010-02-03 | |
|
Review via email:
|
|||
| Aaron Bentley (abentley) wrote : | # |
| Aaron Bentley (abentley) wrote : | # |
After submitting this, I remembered about __import__, so I've replaced exec with __import__.
| Gavin Panella (allenap) wrote : | # |
Hi Aaron,
I can't pretend to fully understand all of this, but the changes look
good. I have one tiny comment.
Gavin.
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -15,6 +15,7 @@
> ]
>
>
> +from calendar import timegm
> import contextlib
> import logging
> import os
> @@ -22,9 +23,8 @@
> import sys
>
> from ampoule import child, pool, main
> -from twisted.internet import defer, error, reactor, stdio
> +from twisted.internet import defer, reactor
> from twisted.protocols import amp
> -from twisted.python import log, reflect
>
> from zope.component import getUtility
> from zope.security.proxy import removeSecurityProxy
> @@ -231,9 +231,25 @@
> class JobRunnerProces
> """Base class for processes that run jobs."""
>
> - def __init__(self):
> + def __init__(self, job_source_name):
> child.AMPChild.
> - self.context_
> + segments = job_source_
> + module = '.'.join(
> + name = segments[-1]
Could you simplify this to:
module, name = job_source_
?
Ah, I guess it wouldn't work if there are no "."s in job_source_name.
| Aaron Bentley (abentley) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Gavin Panella wrote:
>> - def __init__(self):
>> + def __init__(self, job_source_name):
>> child.AMPChild.
>> - self.context_
>> + segments = job_source_
>> + module = '.'.join(
>> + name = segments[-1]
>
> Could you simplify this to:
>
> module, name = job_source_
Done. Thanks for the tip.
> Ah, I guess it wouldn't work if there are no "."s in job_source_name.
If there are no dots, the import will fail anyhow. I can't imagine any
time when it would be sensible to supply a job_source_name with no dots
in it, though.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkt
QUQAni+
=ieiV
-----END PGP SIGNATURE-----

= Summary =
Update to Ampoule 0.2.0.
== Proposed fix ==
This branch updates ampoule and also adds a version for pyOpenSSL, which is a
new Ampoule dependency. This new version of ampoule has many changes that I
suggested, to push as much code upstream as I thought was architecturally
sound.
== Pre-implementation notes ==
None
== Implementation details ==
Instead of having a separate AMPChild subclass for every JobSource, a new
ampoule feature allows us to parameterize the JobRunnerProcess. We supply a
full path to the JobSource. In JobRunnerProcess, we import this and use it. I
used 'exec' for this, because the import module looked crazy complicated.
Instead of supplying our own BOOTSTRAP code in order to provide a bit more
startup code, a new ampoule feature lets us simply implement the context
manager protocol in JobRunnerProcess.
Instead of subclassing pool.ProcessPool to use SIGHUP, ampoule now lets us
parameterize the timout_signal.
Instead of converting our leases, which are datetimes, into timeout durations,
a new ampoule feature lets us supply them as deadlines.
job_class was renamed to job_source where this was a better description of its
usage.
== Tests == preview_ diffs
bin/test -vt test_runner -t update_
== Demo and Q/A ==
No visible change.
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files: services/ job/tests/ test_runner. py services/ job/runner. py code/model/ branchmergeprop osaljob. py
lib/lp/
lib/lp/
versions.cfg
lib/lp/
== Pyflakes notices ==
lib/lp/ services/ job/runner. py
240: undefined name 'job_source'
^^^ This is because of the exec.
== Pylint notices ==
lib/lp/ services/ job/runner. py s.__init_ _] Use of the exec statement s.__init_ _] Undefined variable 'job_source'
35: [F0401] Unable to import 'lazr.delegates' (No module named delegates)
239: [W0122, JobRunnerProces
240: [E0602, JobRunnerProces
^^^ This is because of the exec.
lib/lp/ code/model/ branchmergeprop osaljob. py
22: [F0401] Unable to import 'lazr.delegates' (No module named delegates)
23: [F0401] Unable to import 'lazr.enum' (No module named enum)