assembl.tasks.threaded_model_watcher module

Dispatch model events to another thread, instead of through Celery.

Note that the ModelEventWatcher are Mapper-level flush events, so they cannot create objects. This pushes the logic on another thread, so we’re already using another thread-specific session.

class assembl.tasks.threaded_model_watcher.ThreadDispatcher[source]

Bases: threading.Thread

A thread that will receive CRUD events and hand them to another model watcher.

daemon = True

The class of the model watcher

mw_class

alias of assembl.lib.model_watcher.BaseModelEventWatcher

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.

class assembl.tasks.threaded_model_watcher.ThreadedModelEventWatcher[source]

Bases: object

A IModelEventWatcher that will dispatch events to its ThreadDispatcher