Example #1
0
 def _apply_hook(self, future_hook, func_set_result, func_continue, stage_entered):
     if not future_hook: 
         future_hook = Future.preset(None).set_name('AO empty future hook')
     def completion(future_hook):
         if stage_entered != None:
             self.ao.method_call_hook(stage_entered,self.call_type,self)                    
         val,exc = future_hook.get_val_or_error()
         if exc is not None:
             func_set_result(exc=exc)
         elif isinstance(val,AsyncRV):
             func_set_result(val=val.val)
         else:
             assertions.fail_unless(val is None, "Hook returned a value, but not through AsyncRV", val=val)
             func_continue()
             
     if self.call_type == MethodCallType.Coroutine:
         future_hook.attach_observer(partial(self._async_completion,stage_entered,completion)) # Coroutine - don't block AO thread while waiting for hook's future
     else:
         future_hook.wait()
         completion(future_hook)
Example #2
0
 def progress_caller(increment):
     """Syntactic sugaring for progressing caller without doing anything
     """
     return Future.preset(None).progress_caller(increment)
Example #3
0
 def progress_caller_to(endpoint):
     """Syntactic sugaring for progressing caller to endpoint without doing anything
     """
     return Future.preset(None).progress_caller_to(endpoint)
Example #4
0
 def checkpoint(name):
     """Syntactic sugaring for declaring hook points 
     """
     return Future.preset(None).set_name(name)