A light-weight library to efficiently run series of asynchronous and synchronous tasks concurrently without worrying about managing different threads on your own.
PyExecutors - A simple multi-threading task management library
Are you great with multi-threading?
PyExecutors is a utility module which provides straight-forward, powerful functions for working with asynchronous python functions.
This runs an array of functions in series. You can program the functions to run synchronously or asynchronously in the order you desire.
pip install pyexecutors
Then, from a python interpreter
from pyexecutors.executors.Executors import SyncTasks, AsyncTasks, Executors def execute_method(exec_thread_number): // your function Executors() \ .enqueue(AsyncTasks(execute_method, args=(1,))) \ .enqueue(AsyncTasks(execute_method, args=(2,))) \ .enqueue(SyncTasks(execute_method, args=(3,))) \ .enqueue(AsyncTasks(execute_method, args=(4,))) \ .execute()
How does it work
A synchronous functions runs by encapsulating itself with RLocks . The lock is released after the functions' execution is complete
Asynchronous takes the help of Barriers. The idea is to create a barrier with the limit being the number of consecutive async functions. A new barrier is created when a Sync function comes in between.
pip install pytest pytest
The test function simply matches the thread number with the argument passed to the functions. The argument has been given to match the order of thread execution
Code & Issues
If you are a developer and you wish to contribute to the library please fork the project and submit a pull request. Follow Github Flow for collaboration! If you have any questions, feel free to ask me about whatever you want.
This project is licensed under the MIT License - see the LICENSE.md file for details
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pyexecutors-0.2.5.tar.gz (4.3 kB)||File type Source||Python version None||Upload date||Hashes View|