celery.utils.timer2

Scheduler for Python functions.

备注

This is used for the thread-based worker only, not for amqp/redis/sqs/qpid where kombu.asynchronous.timer is used.

class celery.utils.timer2.Entry(fun, args=None, kwargs=None)[源代码]

Schedule Entry.

args
cancel()[源代码]
canceled
property cancelled
fun
kwargs
tref
celery.utils.timer2.Schedule

Timer 的别名

class celery.utils.timer2.Timer(schedule: Timer | None = None, on_error: Callable[[Exception], None] | None = None, on_tick: Callable[[float], None] | None = None, on_start: Callable[[Timer], None] | None = None, max_interval: float | None = None, **kwargs: Any)[源代码]

Timer thread.

备注

This is only used for transports not supporting AsyncIO.

class Entry(fun, args=None, kwargs=None)

Schedule Entry.

args
cancel()
canceled
property cancelled
fun
kwargs
tref
Schedule

Timer 的别名

call_after(*args: Any, **kwargs: Any) Entry[源代码]
call_at(*args: Any, **kwargs: Any) Entry[源代码]
call_repeatedly(*args: Any, **kwargs: Any) Entry[源代码]
cancel(tref: Entry) None[源代码]
clear() None[源代码]
empty() bool[源代码]
ensure_started() None[源代码]
enter(entry: Entry, eta: float, priority: int | None = None) Entry[源代码]
enter_after(*args: Any, **kwargs: Any) Entry[源代码]
exit_after(secs: float, priority: int = 10) None[源代码]
next() float | None
on_tick: Callable[[float], None] | None = None
property queue: list
run() None[源代码]

Method representing the thread's activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object's constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

running: bool = False
stop() None[源代码]
celery.utils.timer2.to_timestamp(d, default_timezone=zoneinfo.ZoneInfo(key='UTC'), time=<built-in function monotonic>)[源代码]

Convert datetime to timestamp.

If d' is already a timestamp, then that will be used.