adata.tasks module

Threads and processes

Adata tasks can run on the main thread or spawn new threads. Any script can publish and be subscribed to a pubsub topic.

You can be connected to MQTT or Websockets data streams, or create your own scheduled tasks to read databases or process files, and fire your events to a topic channel when something happens, so all the subscribed handlers do their job.

TODO: Subprocesses

class Task(app, task, name='')

Bases: threading.Thread

Create a new thread and execute the task.

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.

class Watcher(function, period=0.2)

Bases: threading.Thread

Thread to call a function in a loop

loop()
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()
EVT_TASK(win, func)

Previous topic

adata.sqlite module