def _blockFromThread(self, function, *args, **kwargs):
     block = kwargs.get('block', None)
     if block is None:
         raise error.MissingBlockArgument("'block' keyword argument is missing")
     result = blockingCallFromThread(function, *args, **kwargs)
     if not block:
         result = PendingResult(self, result)
     return result
Esempio n. 2
0
 def queue_status(self, verbose=False):
     """Get a dictionary with the current state of the task queue.
     
     If verbose is True, then return lists of taskids, otherwise, 
     return the number of tasks with each status.
     """
     return blockingCallFromThread(self.task_controller.queue_status,
                                   verbose)
 def get_result(self, i=None, targets=None, block=None):
     targets, block = self._findTargetsAndBlock(targets, block)
     result = blockingCallFromThread(self.smultiengine.get_result, i, targets=targets, block=block)
     if block:
         result = ResultList(result)
     else:
         result = PendingResult(self, result)
         result.add_callback(wrapResultList)
     return result
Esempio n. 4
0
 def spin(self):
     return blockingCallFromThread(self.task_controller.spin)
Esempio n. 5
0
 def barrier(self, taskids):
     return blockingCallFromThread(self.task_controller.barrier, taskids)
Esempio n. 6
0
 def abort(self, taskid):
     return blockingCallFromThread(self.task_controller.abort, taskid)
Esempio n. 7
0
 def get_task_result(self, taskid, block=False):
     return blockingCallFromThread(self.task_controller.get_task_result,
         taskid, block)
Esempio n. 8
0
 def run(self, task):
     return blockingCallFromThread(self.task_controller.run, task)
 def get_ids(self):
     result = blockingCallFromThread(self.smultiengine.get_ids)
     return result
 def flush(self):
     r = blockingCallFromThread(self.smultiengine.clear_pending_deferreds)
     return r
 def get_pending_deferred(self, deferredID, block):
     return blockingCallFromThread(self.smultiengine.get_pending_deferred, deferredID, block)