[Checkins] SVN: zc.async/trunk/s Add test for "display" in asyncdb jobstats and jobs

Gary Poster gary at modernsongs.com
Mon Sep 15 20:17:55 EDT 2008


Log message for revision 91185:
  Add test for "display" in asyncdb jobstats and jobs
  

Changed:
  U   zc.async/trunk/setup.py
  U   zc.async/trunk/src/zc/async/TODO.txt
  U   zc.async/trunk/src/zc/async/monitordb.txt

-=-
Modified: zc.async/trunk/setup.py
===================================================================
--- zc.async/trunk/setup.py	2008-09-15 22:30:28 UTC (rev 91184)
+++ zc.async/trunk/setup.py	2008-09-16 00:17:53 UTC (rev 91185)
@@ -72,7 +72,7 @@
 
 setup(
     name='zc.async',
-    version='1.4.2a6',
+    version='1.5.0a1',
     namespace_packages=['zc'],
     packages=find_packages('src'),
     package_dir={'':'src'},
@@ -97,8 +97,8 @@
         'zc.dict>=1.2.1',
         'zc.twist>=1.3',
         'Twisted>=8.0.1', # 8.0 was setuptools compatible, 8.0.1 had bugfixes.
-        # note that Twisted builds with warnings with py2.4.  It
-        # seems to still build ok.
+        # note that Twisted builds with warnings with py2.4.  It works fine,
+        # and is considered a supported Python version on the Twisted site.
         'zope.bforest>=1.2',
         'zope.component',
         'zope.event',

Modified: zc.async/trunk/src/zc/async/TODO.txt
===================================================================
--- zc.async/trunk/src/zc/async/TODO.txt	2008-09-15 22:30:28 UTC (rev 91184)
+++ zc.async/trunk/src/zc/async/TODO.txt	2008-09-16 00:17:53 UTC (rev 91185)
@@ -1,7 +1,7 @@
 - need to show in monitordb test that completed, in-agent, and pending jobs
-  do a merge sort (esp. completed, because this si important to the semantics
+  do a merge sort (esp. completed, because this is important to the semantics
   of lastcompleted.
-- need test for "display" in asyncdb jobstats and jobs
+- fill out XXXs in CHANGES
 
 - fix up tips so that it looks better
 - write a zc.buildout/grok quickstart

Modified: zc.async/trunk/src/zc/async/monitordb.txt
===================================================================
--- zc.async/trunk/src/zc/async/monitordb.txt	2008-09-15 22:30:28 UTC (rev 91184)
+++ zc.async/trunk/src/zc/async/monitordb.txt	2008-09-16 00:17:53 UTC (rev 91185)
@@ -167,7 +167,7 @@
 The ``jobs`` command lists all of the jobs in one or more states, identifying
 them with integer OIDs and database names.
 
-    >>> connection.test_input('asyncdb jobs pending\n') # doctest: +ELLIPSIS
+    >>> connection.test_input('asyncdb jobs pending\n')
     [
         [
             30, 
@@ -196,6 +196,50 @@
     ] 
     -> CLOSE
 
+You can also get reprs of the jobs instead, or full details.
+
+    >>> connection.test_input('asyncdb jobs pending display:repr\n')
+    [
+        "<zc.async.job.Job (oid 30, db 'unnamed') ``zc.async.doctest_test.raise_exception()``>", 
+        "<zc.async.job.Job (oid 31, db 'unnamed') ``zc.async.doctest_test.active_pause()``>", 
+        "<zc.async.job.Job (oid 32, db 'unnamed') ``zc.async.doctest_test.sum_silly(18, 18, start=6)``>", 
+        "<zc.async.job.Job (oid 33, db 'unnamed') ``zc.async.doctest_test.active_pause2()``>", 
+        "<zc.async.job.Job (oid 34, db 'unnamed') ``zc.async.doctest_test.send_message()``>", 
+        "<zc.async.job.Job (oid 35, db 'unnamed') ``__builtin__.sum((18, 18, 6))``>"
+    ] 
+    -> CLOSE
+
+For the full details example, we only show the first job, in the interest of
+space.
+
+    >>> connection.test_input('asyncdb jobs pending display:details\n')
+    ... # doctest: +ELLIPSIS
+    [
+        {
+            "active": null, 
+            "active end": null, 
+            "active start": null, 
+            "agent": null, 
+            "args": [], 
+            "begin after": "2006-08-10T15:44:23.000211Z", 
+            "callbacks": [], 
+            "dispatcher": null, 
+            "failed": false, 
+            "initial callbacks end": null, 
+            "kwargs": {}, 
+            "queue": "", 
+            "quota names": [], 
+            "repr": "<zc.async.job.Job (oid 30, db 'unnamed') ``zc.async.doctest_test.raise_exception()``>", 
+            "result": "None", 
+            "status": "pending", 
+            "wait": {
+                "seconds": 0.0
+            }
+        }, ...
+    ] 
+    -> CLOSE
+
+
 You can also count and get stats for these, with the same arguments.
 
     >>> connection.test_input('asyncdb count pending\n')
@@ -293,7 +337,84 @@
     } 
     -> CLOSE
 
+Alternatively, we could have used the "display:repr" or "display:details" with
+"jobstats," as with "jobs".
 
+    >>> connection.test_input('asyncdb jobstats pending display:repr\n')
+    {
+        "active": 0, 
+        "assigned": 0, 
+        "callbacks": 0, 
+        "failed": 0, 
+        "longest active": null, 
+        "longest wait": [
+            {
+                "seconds": 0.0
+            }, 
+            "<zc.async.job.Job (oid 30, db 'unnamed') ``zc.async.doctest_test.raise_exception()``>"
+        ], 
+        "pending": 6, 
+        "shortest active": null, 
+        "shortest wait": [
+            {
+                "seconds": 0.0
+            }, 
+            "<zc.async.job.Job (oid 30, db 'unnamed') ``zc.async.doctest_test.raise_exception()``>"
+        ], 
+        "succeeded": 0
+    } 
+    -> CLOSE
+
+    >>> connection.test_input('asyncdb jobstats pending display:details\n')
+    ... # doctest: +ELLIPSIS
+    {
+        "active": 0, 
+        "assigned": 0, 
+        "callbacks": 0, 
+        "failed": 0, 
+        "longest active": null, 
+        "longest wait": [
+            {
+                "seconds": 0.0
+            }, 
+            {
+                "active": null, 
+                "active end": null, 
+                "active start": null, 
+                "agent": null, 
+                "args": [], 
+                "begin after": "2006-08-10T15:44:23.000211Z", 
+                "callbacks": [], 
+                "dispatcher": null, 
+                "failed": false, 
+                "initial callbacks end": null, 
+                "kwargs": {}, 
+                "queue": "", 
+                "quota names": [], 
+                "repr": "<zc.async.job.Job (oid 30, db 'unnamed') ``zc.async.doctest_test.raise_exception()``>", 
+                "result": "None", 
+                "status": "pending", 
+                "wait": {
+                    "seconds": 0.0
+                }
+            }
+        ], 
+        "pending": 6, 
+        "shortest active": null, 
+        "shortest wait": [
+            {
+                "seconds": 0.0
+            }, 
+            {
+                ...
+                "repr": "<zc.async.job.Job (oid 30, db 'unnamed') ``zc.async.doctest_test.raise_exception()``>", 
+                ...
+            }
+        ], 
+        "succeeded": 0
+    } 
+    -> CLOSE
+
 Specifying the database name is equivalent (note that, confusingly, this
 database's name is "unnamed").
 



More information about the Checkins mailing list