Skip to main content

parallelizer

Parallel execution of your tasks simplified! This package can be used as an alternative to Python's concurrent.futures executors, or as an analog of Java's ExecutorService.

Two simple wrappers (thread-based and process-based), that allow for easy split and parallel processing of your jobs.

Description

This package provides two classes:

  • ThreadParallelizer to execute your jobs in new threads
  • ProcessParallelizer to execute your jobs in new processes

This is a pure python implementation, with usage of threading and multiprocessing packages

Note that the wrappers appear to be in sync (from the caller's perspective), they will wait until all inner tasks are completed.

Installation

Normal installation

pip install parallelizer

Development installation

git clone https://github.com/jpleorx/parallelizer.git
cd parallelizer
pip install --editable .

Example

import time
from parallelizer import ThreadParallelizer, ProcessParallelizer, repeat

def power_function(base: int, power: int) -> int:
    time.sleep(1)
    return base ** power

inputs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
number_of_threads = 5

thread_parallelizer = ThreadParallelizer(number_of_threads)
results = thread_parallelizer.execute(power_function, [inputs, repeat(2, len(inputs))])

process_parallelizer = ProcessParallelizer(number_of_threads)
results = process_parallelizer.execute(power_function, [inputs, repeat(2, len(inputs))])

Metadata

Release files for parallelizer 0.1

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

Source distribution (sdist)

Source distribution for parallelizer 0.1
File Size Uploaded
parallelizer-0.1.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for parallelizer 0.1
File Interpreter ABI Platform
parallelizer-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.9 kB

Release files / parallelizer-0.1.tar.gz

Download URL parallelizer-0.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
896284dc4d05e9c2ac733c2c9d048a74fa24fb0d13c9d43a20e7902c22a4021e
BLAKE2b-256 checksum
How to use checksums
ae75b9e378a4f3db895f74fbfb39aefce26d6a7533f9c85f3633ed44d748e784
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5

Release files / parallelizer-0.1-py3-none-any.whl

Download URL parallelizer-0.1-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa6e7b73ac6bec9a47f777524fb7f25e704a9768db7a3d6c595bd58ed70bbbb0
BLAKE2b-256 checksum
How to use checksums
b172c4c65288b4dcf6faad90524efac6c70eda2b9bb50eeabc30d85270d29a8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

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