MCPcopy Create free account
hub / github.com/celery/celery / Timer

Class Timer

celery/worker/components.py:32–53  ·  view source on GitHub ↗

Timer bootstep.

Source from the content-addressed store, hash-verified

30
31
32class Timer(bootsteps.Step):
33 """Timer bootstep."""
34
35 def create(self, w):
36 if w.use_eventloop:
37 # does not use dedicated timer thread.
38 w.timer = _Timer(max_interval=10.0)
39 else:
40 if not w.timer_cls:
41 # Default Timer is set by the pool, as for example, the
42 # eventlet pool needs a custom timer implementation.
43 w.timer_cls = w.pool_cls.Timer
44 w.timer = self.instantiate(w.timer_cls,
45 max_interval=w.timer_precision,
46 on_error=self.on_timer_error,
47 on_tick=self.on_timer_tick)
48
49 def on_timer_error(self, exc):
50 logger.error('Timer error: %r', exc, exc_info=True)
51
52 def on_timer_tick(self, delay):
53 logger.debug('Timer wake-up! Next ETA %s secs.', delay)
54
55
56class Hub(bootsteps.StartStopStep):

Callers 1

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…