[Checkins] SVN: zc.async/trunk/s Add test that twisted's main installed reactor can work.
Gary Poster
gary at modernsongs.com
Fri Aug 22 00:14:11 EDT 2008
Log message for revision 90112:
Add test that twisted's main installed reactor can work.
Also some additional small doc fixes/changes.
Changed:
U zc.async/trunk/sphinx/.static/default.css
U zc.async/trunk/src/zc/async/CHANGES.txt
U zc.async/trunk/src/zc/async/QUICKSTART_1_VIRTUALENV.txt
U zc.async/trunk/src/zc/async/README_1.txt
U zc.async/trunk/src/zc/async/tests.py
A zc.async/trunk/src/zc/async/twisted.txt
-=-
Modified: zc.async/trunk/sphinx/.static/default.css
===================================================================
--- zc.async/trunk/sphinx/.static/default.css 2008-08-22 03:32:05 UTC (rev 90111)
+++ zc.async/trunk/sphinx/.static/default.css 2008-08-22 04:14:10 UTC (rev 90112)
@@ -870,6 +870,7 @@
background: transparent;
}
+div#agents div.highlight,
div#a-job div.highlight,
div#make-a-file div.highlight {
background-color: #fff;
Modified: zc.async/trunk/src/zc/async/CHANGES.txt
===================================================================
--- zc.async/trunk/src/zc/async/CHANGES.txt 2008-08-22 03:32:05 UTC (rev 90111)
+++ zc.async/trunk/src/zc/async/CHANGES.txt 2008-08-22 04:14:10 UTC (rev 90112)
@@ -18,7 +18,7 @@
- Added zc.async.partial.Partial for backward compatibility purposes.
-- Fix support for Twisted installed reactor XXX NEEDS TEST
+- Fix support for Twisted installed reactor
- Fix retry behavior for parallel and serial jobs XXX NEEDS TEST
@@ -32,7 +32,7 @@
1.4.1 (2008-07-30)
==================
-- The new ``serial`` and ``parallel`` helpers did not allow the the
+- The new ``serial`` and ``parallel`` helpers did not allow the
``postprocess`` argument to be a partial closure, and were being naughty.
Fixed.
Modified: zc.async/trunk/src/zc/async/QUICKSTART_1_VIRTUALENV.txt
===================================================================
--- zc.async/trunk/src/zc/async/QUICKSTART_1_VIRTUALENV.txt 2008-08-22 03:32:05 UTC (rev 90111)
+++ zc.async/trunk/src/zc/async/QUICKSTART_1_VIRTUALENV.txt 2008-08-22 04:14:10 UTC (rev 90112)
@@ -1,3 +1,4 @@
+.. _quickstart-with-virtualenv:
==============================
Quickstart with ``virtualenv``
@@ -329,11 +330,6 @@
of `Hadoop`_: we will want to distribute the work of running the simulation to
multiple machines so the result can be done faster.
-.. note::
-
- The ``zc.buildout`` quick-start instead uses |async| to generate PDFs
- on the fly, if you'd like a different usage example.
-
.. _`Monte Carlo simulation`: http://en.wikipedia.org/wiki/Monte_Carlo_method
.. _`Hadoop`: http://hadoop.apache.org/core/
Modified: zc.async/trunk/src/zc/async/README_1.txt
===================================================================
--- zc.async/trunk/src/zc/async/README_1.txt 2008-08-22 03:32:05 UTC (rev 90111)
+++ zc.async/trunk/src/zc/async/README_1.txt 2008-08-22 04:14:10 UTC (rev 90112)
@@ -792,10 +792,11 @@
Conclusion
==========
-This concludes our discussion of zc.async usage. The `next section`_ shows how
-to configure zc.async without Zope 3 [#stop_usage_reactor]_.
+This concludes our discussion of zc.async usage. The :ref:`next section
+<configuration-without-zope-3>` shows how to configure zc.async without
+Zope 3 [#stop_usage_reactor]_.
-.. _next section: :ref:`configuration-without-zope-3`
+.. _`next section`: :ref:`configuration-without-zope-3`
.. rubric:: Footnotes
Modified: zc.async/trunk/src/zc/async/tests.py
===================================================================
--- zc.async/trunk/src/zc/async/tests.py 2008-08-22 03:32:05 UTC (rev 90111)
+++ zc.async/trunk/src/zc/async/tests.py 2008-08-22 04:14:10 UTC (rev 90112)
@@ -143,6 +143,7 @@
'agent.txt',
'dispatcher.txt',
'subscribers.txt',
+ 'twisted.txt',
'README_1.txt',
'README_2.txt',
'catastrophes.txt',
Added: zc.async/trunk/src/zc/async/twisted.txt
===================================================================
--- zc.async/trunk/src/zc/async/twisted.txt (rev 0)
+++ zc.async/trunk/src/zc/async/twisted.txt 2008-08-22 04:14:10 UTC (rev 90112)
@@ -0,0 +1,43 @@
+This is a regression test to show that the main, installed Twisted reactor
+can be used with the dispatcher.
+
+ >>> import ZODB.FileStorage
+ >>> storage = ZODB.FileStorage.FileStorage(
+ ... 'zc_async.fs', create=True)
+ >>> from ZODB.DB import DB
+ >>> db = DB(storage)
+ >>> import zc.async.configure
+ >>> zc.async.configure.base()
+ >>> zc.async.configure.start(db, poll_interval=0.1, twisted=True)
+ >>> def do_work():
+ ... return 42
+ ...
+ >>> import twisted.internet.reactor
+ >>> def stop_reactor(result):
+ ... twisted.internet.reactor.callFromThread(
+ ... twisted.internet.reactor.stop)
+ ...
+ >>> import zc.async.queue
+ >>> import zc.async.instanceuuid
+ >>> oid = None
+ >>> import transaction
+ >>> def install_job(db):
+ ... conn = db.open()
+ ... try:
+ ... q = zc.async.queue.getDefaultQueue(conn)
+ ... j = q.put(do_work)
+ ... j.addCallback(stop_reactor)
+ ... transaction.commit()
+ ... global oid
+ ... oid = j._p_oid
+ ... finally:
+ ... transaction.abort()
+ ... conn.close()
+ ...
+ >>> ignore = twisted.internet.reactor.callWhenRunning(install_job, db)
+ >>> twisted.internet.reactor.run()
+ >>> conn = db.open()
+ >>> j = conn.get(oid)
+ >>> import zc.async.testing
+ >>> zc.async.testing.wait_for_result(j)
+ 42
Property changes on: zc.async/trunk/src/zc/async/twisted.txt
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the Checkins
mailing list