Skip to main content

PyExecutors - A simple multi-threading task management library

Travis Passing PyPI version PyPI Downloads PyPI license Downloads

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.

Installation

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

Synchronous Functions

A synchronous functions runs by encapsulating itself with RLocks . The lock is released after the functions' execution is complete

Asynchronous Functions

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.

Running Tests

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.

Project Maintainers

This project is founded and actively maintained by Tanmay Majumdar. For any sort of queries feel free to mail at tanmay.majumdar@hotmail.com

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Release files for pyexecutors 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyexecutors 0.2.5
File Size Uploaded
pyexecutors-0.2.5.tar.gz 4.3 kB Details

Release files / pyexecutors-0.2.5.tar.gz

Download URL pyexecutors-0.2.5.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5ed3088c5d09710bd65de7c0c15a437fd649bddfbc7b9b6e5c76cdf24a2227f4
BLAKE2b-256 checksum
How to use checksums
6d506bd884ba71a1cd326f3f3e64511ec2ea9205148463eae61c0a1cd353ad29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.6.10

Release history Release notifications | RSS feed

This release

0.2.5 This release

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page