This document describes the current stable version of Celery (5.1). For development docs, go here.

celery.utils.timer2

Scheduler for Python functions.

Note

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)[source]

Schedule Entry.

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

alias of kombu.asynchronous.timer.Timer

class celery.utils.timer2.Timer(schedule=None, on_error=None, on_tick=None, on_start=None, max_interval=None, **kwargs)[source]

Timer thread.

Note

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

alias of kombu.asynchronous.timer.Timer

call_after(*args, **kwargs)[source]
call_at(*args, **kwargs)[source]
call_repeatedly(*args, **kwargs)[source]
cancel(tref)[source]
clear()[source]
empty()[source]
ensure_started()[source]
enter(entry, eta, priority=None)[source]
enter_after(*args, **kwargs)[source]
exit_after(secs, priority=10)[source]
next()
on_tick = None
property queue
run()[source]

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 = False
stop()[source]
celery.utils.timer2.to_timestamp(d, default_timezone=<UTC>, time=<built-in function monotonic>)[source]

Convert datetime to timestamp.

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