- Timestamp:
- 9 Aug 2012, 09:52:28 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/async.py
r9082 r9102 35 35 ) 36 36 37 def compute(num ):37 def compute(num, duration=60): 38 38 """A convenience function to test asynchronous jobs. 39 40 `duration` gives the seconds, this job should (artificially) need 41 for completing. 39 42 """ 40 43 start = time.time() 41 duration = 6042 44 end = start + duration 43 45 print "MyJob starts computation at ", start … … 60 62 print "MyJob's percent: %r" % zc.async.local.getLiveAnnotation( 61 63 'percent') 64 zc.async.local.setLiveAnnotation('percent', 100.0) 62 65 return num * 2 63 66 … … 70 73 grok.implements(IJob, IProgressable) 71 74 grok.provides(IJob) 72 73 75 percent = None 74 76 … … 183 185 return 184 186 185 def start_test_job(self ):187 def start_test_job(self, duration=60, site=None): 186 188 """Start a test job. 187 189 … … 190 192 :func:`compute` function with ``23`` as argument. 191 193 """ 192 job = AsyncJob(compute, 23 )193 job_id = self.put(job )194 job = AsyncJob(compute, 23, duration) 195 job_id = self.put(job, site=site) 194 196 return job_id 195 197
Note: See TracChangeset for help on using the changeset viewer.