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

Method __init__

celery/utils/timer2.py:46–65  ·  view source on GitHub ↗
(self, schedule: Optional[Schedule] = None,
                 on_error: Optional[Callable[[Exception], None]] = None,
                 on_tick: Optional[Callable[[float], None]] = None,
                 on_start: Optional[Callable[['Timer'], None]] = None,
                 max_interval: Optional[float] = None, **kwargs: Any)

Source from the content-addressed store, hash-verified

44 super().start(*args, **kwargs)
45
46 def __init__(self, schedule: Optional[Schedule] = None,
47 on_error: Optional[Callable[[Exception], None]] = None,
48 on_tick: Optional[Callable[[float], None]] = None,
49 on_start: Optional[Callable[['Timer'], None]] = None,
50 max_interval: Optional[float] = None, **kwargs: Any) -> None:
51 self.schedule = schedule if schedule is not None else self.Schedule(
52 on_error=on_error, max_interval=max_interval)
53 self.on_start = on_start
54 self.on_tick = on_tick or self.on_tick
55 super().__init__()
56 # `_is_stopped` is likely to be an attribute on `Thread` objects so we
57 # double underscore these names to avoid shadowing anything and
58 # potentially getting confused by the superclass turning these into
59 # something other than an `Event` instance (e.g. a `bool`)
60 self.__is_shutdown = threading.Event()
61 self.__is_stopped = threading.Event()
62 self.mutex = threading.Lock()
63 self.not_empty = threading.Condition(self.mutex)
64 self.daemon = True
65 self.name = f'Timer-{next(self._timer_count)}'
66
67 def _next_entry(self) -> Optional[float]:
68 with self.not_empty:

Callers

nothing calls this directly

Calls 1

EventMethod · 0.80

Tested by

no test coverage detected