celery.utils.threads

Threading primitives and utilities.

class celery.utils.threads.Local[исходный код]

Local object.

class celery.utils.threads.LocalManager(locals=None, ident_func=None)[исходный код]

Local objects cannot manage themselves.

For that you need a local manager. You can pass a local manager multiple locals or add them later by appending them to manager.locals. Every time the manager cleans up, it will clean up all the data left in the locals for this context.

The ident_func parameter can be added to override the default ident function for the wrapped locals.

cleanup()[исходный код]

Manually clean up the data in the locals for this context.

Call this at the end of the request or use make_middleware().

get_ident()[исходный код]

Return context identifier.

This is the identifier the local objects use internally for this context. You cannot override this method to change the behavior but use it to link other context local objects (such as SQLAlchemy’s scoped sessions) to the Werkzeug locals.

celery.utils.threads.LocalStack

alias of _LocalStack

class celery.utils.threads.bgThread(name=None, **kwargs)[исходный код]

Background service thread.

body()[исходный код]
on_crash(msg, *fmt, **kwargs)[исходный код]
run()[исходный код]

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.

stop()[исходный код]

Graceful shutdown.

celery.utils.threads.default_socket_timeout(timeout)[исходный код]

Context temporarily setting the default socket timeout.

celery.utils.threads.get_ident()

getcurrent() -> greenlet

Returns the current greenlet (i.e. the one which called this function).

Вернуться на верх