RunTask is a python module implementing a coherent time task scheduler in a very simple way. The tasks can be python callables (functions, methods) or synchronization objects from the threading module (Event, Lock, Semaphore, BoundedSemaphore). The execution order of all controlled tasks is stricktly predictable and execution times are aligned to given reference times. The scheduling time can be speed up or slow down with respect to the system time. It can be also moved forward and backward by an offset addition. This can useful for debugging events with periods that are too long or too short to be seen in a comfortable way.
An example. Suppose to have tasks A, B that need to be run at the beginning of each minute, in that order. In addition, suppose to have tasks C, D that need to be run at the begining of each second, in that order. Moreover, since the beginning of each minute is coincident with the beginning of a second, it is wanted that the task group A, B is run before the task group C, D. RunTask is designed to fulfill all these kind of requirements.
This is the documentation for version 0.5.0.
RunTask is released under the GNU General Public License.
At present, version 0.5.0, RunTask is in alpha status. Any debugging aid is welcome.
For any question, suggestion, contribution contact the author Fabrizio Pollastri <f.pollastri_a_t_inrim.it>.
RunTask is not a preemptive scheduler, so all tasks are run sequentially when their run time is reached.
Since all tasks are run within the same thread, all tasks must be non-blocking.
The tasks controlled by RunTask are thread safe with respect to each other. Since, RunTask is instantiated by a main program, the controlled tasks are NOT thread safe with respect to the main program.
At present, RunTask has a static design: all task must be registered at program beginning and cannot be changed during execution.
Each task target can be registered only one time.
Threads in python can be run only serially, so they do not benefit from multiprocessor architectures.
To run the code, Python 2.6 or later must already be installed. The latest release is recommended. Python is available from http://www.python.org/.
Open a shell.
Get root privileges and install the package. Command:
pip install runtask