exopy.tasks.tasks.decorators module¶
Definition of the base tasks.
The base tasks define how task interact between them and with the database, how ressources can be shared and how preferences are handled.
-
exopy.tasks.tasks.decorators.
handle_stop_pause
(root)[source]¶ Check the state of the stop and pause event and handle the pause.
When the pause stops the main thread take care of re-initializing the driver owners (so that any user modification shoudl not cause a crash) and signal the other threads it is done by setting the resume flag.
-
exopy.tasks.tasks.decorators.
make_stoppable
(function_to_decorate)[source]¶ Decorator allowing to stop or pause at the beginning of a task.
This is applied the perform method of every task marked as stoppable. This check is performed before dealing with parallelism or waiting.
-
exopy.tasks.tasks.decorators.
smooth_crash
(function_to_decorate)[source]¶ This decorator ensures that any unhandled error will cause the measurement to stop in a nice way. It is always present at the root call of any thread.
-
class
exopy.tasks.tasks.decorators.
ThreadDispatcher
(perform, pool)[source]¶ Bases:
atom.atom.Atom
Dispatch calling a function to a thread.
-
inactive
¶ Flag set when the thread is ready to accept new jobs.
-
-
exopy.tasks.tasks.decorators.
make_parallel
(perform, pool)[source]¶ Machinery to execute perform in parallel.
Create a wrapper around a method to execute it in a thread and register the thread.
- Parameters
perform (method) – Method which should be wrapped to run in parallel.
pool (str) – Name of the execution pool to which the created thread belongs.
-
exopy.tasks.tasks.decorators.
make_wait
(perform, wait, no_wait)[source]¶ Machinery to make perform wait on other tasks execution.
Create a wrapper around a method to wait for some threads to terminate before calling the method. Threads are grouped in execution pools. This method supports new threads being started while it is waiting.
- Parameters
perform (method) – Method which should be wrapped to wait on threads.
wait (list(str)) – Names of the execution pool which should be waited for.
no_wait (list(str)) – Names of the execution pools which should not be waited for.
parameters are mutually exlusive. If both lists are empty the (Both) –
will be deffered till all the execution pools have completed (execution) –
works. (their) –