예제 #1
0
 def func(*args, **kwargs):
     done = event.Event()
     loop = loopingcall.DynamicLoopingCall(_func, done, *args, **kwargs)
     loop.start(periodic_interval_max=self._max_sleep_time)
     result = done.wait()
     loop.stop()
     return result
예제 #2
0
 def add_dynamic_timer(self,
                       callback,
                       initial_delay=None,
                       periodic_interval_max=None,
                       *args,
                       **kwargs):
     timer = loopingcall.DynamicLoopingCall(callback, *args, **kwargs)
     timer.start(initial_delay=initial_delay,
                 periodic_interval_max=periodic_interval_max)
     self.timers.append(timer)
예제 #3
0
파일: api.py 프로젝트: mshabdiz/cinder
 def func(*args, **kwargs):
     loop = loopingcall.DynamicLoopingCall(_func, *args, **kwargs)
     timer = loop.start(periodic_interval_max=self._max_sleep_time)
     return timer.wait()