Пример #1
0
 def __init__(self,
              func,
              arg,
              uniq=None,
              background=False,
              high_priority=False,
              timeout=None,
              retry_count=0):
     Task.__init__(self, func, arg, uniq, background, high_priority,
                   timeout, retry_count)
Пример #2
0
 def dispatch_background_task(self,
                              func,
                              arg,
                              uniq=None,
                              high_priority=False):
     """Submit a background task and return its handle."""
     task = Task(func,
                 arg,
                 uniq,
                 background=True,
                 high_priority=high_priority)
     taskset = Taskset([task])
     self.do_taskset(taskset)
     return task.handle
Пример #3
0
 def testTimeout(self):
     self.failUnlessEqual(self.client.do_task(Task("sleep", "0.1")), '0.1')
     self.failUnlessRaises(self.client.TaskFailed, lambda:self.client.do_task(Task("sleep", "1.5")))
Пример #4
0
 def testCompleteAfterFail(self):
     self.failUnlessRaises(self.client.TaskFailed, lambda:self.client.do_task(Task("fail", "bar")))
     self.failUnlessEqual(self.client.do_task(Task("echo", "bar")), 'bar')
Пример #5
0
 def testFail(self):
     self.failUnlessRaises(self.client.TaskFailed, lambda:self.client.do_task(Task("fail", "bar")))
Пример #6
0
 def testComplete(self):
     self.failUnlessEqual(self.client.do_task(Task("echo", "bar")), 'bar')
Пример #7
0
 def __init__(self,func,arg,uniq=None,background=False,high_priority=False,timeout=None,retry_count=0):
     Task.__init__(self,func,arg,uniq,background,high_priority,timeout,retry_count)
Пример #8
0
 def __call__(self, func, arg, uniq=None, **kwargs):
     return self.do_task(Task(func, arg, uniq, **kwargs))