[Checkins] SVN: Sandbox/gotcha/z3c.taskqueue/src/z3c/taskqueue/startlater.txt startlater test passes
Godefroid Chapelle
gotcha at bubblenet.be
Mon Mar 8 11:35:43 EST 2010
Log message for revision 109838:
startlater test passes
Changed:
U Sandbox/gotcha/z3c.taskqueue/src/z3c/taskqueue/startlater.txt
-=-
Modified: Sandbox/gotcha/z3c.taskqueue/src/z3c/taskqueue/startlater.txt
===================================================================
--- Sandbox/gotcha/z3c.taskqueue/src/z3c/taskqueue/startlater.txt 2010-03-08 16:32:31 UTC (rev 109837)
+++ Sandbox/gotcha/z3c.taskqueue/src/z3c/taskqueue/startlater.txt 2010-03-08 16:35:38 UTC (rev 109838)
@@ -8,38 +8,11 @@
Usage
_____
- >>> STOP_SLEEP_TIME = 0.02
-
Let's now start by creating a single service:
>>> from z3c import taskqueue
>>> service = taskqueue.TaskService()
-The object should be located, so it gets a name:
-
- >>> from zope.app.folder import Folder
- >>> site1 = Folder()
- >>> root['site1'] = site1
- >>> from zope.app.component.site import LocalSiteManager
- >>> from zope.security.proxy import removeSecurityProxy
- >>> sm = LocalSiteManager(removeSecurityProxy(site1))
- >>> site1.setSiteManager(sm)
-
- >>> sm['default']['testTaskService1'] = service
- >>> service = sm['default']['testTaskService1'] # caution! proxy
- >>> service.__name__
- u'testTaskService1'
- >>> service.__parent__ is sm['default']
- True
-
-Let's register it under the name `TestTaskService1`:
-
- >>> from zope import component
- >>> from z3c.taskqueue import interfaces
- >>> sm = site1.getSiteManager()
- >>> sm.registerUtility(service, interfaces.ITaskService,
- ... name='TestTaskService1')
-
Let's now define a task that simply echos an input string:
>>> def echo(input):
@@ -113,7 +86,8 @@
From this point on the job will behave as it were added with ``add`` without
the ``startLater=True`` parameter.
- >>> service.process()
+ >>> service.processNext()
+ True
>>> service.getStatus(jobid)
'completed'
@@ -124,7 +98,3 @@
>>> service.getError(jobid)
'None'
- >>> service.stopProcessing()
-
- >>> import time
- >>> time.sleep(STOP_SLEEP_TIME)
More information about the checkins
mailing list