Offloading tasks in threads or processes
Project description
Offloading
Offloading tasks using processes
Table of Contents
Installation
pip install offloading
License
offloading
is distributed under the terms of the MIT license.
Usage
from offloading import offload, Task
def get_result(x):
return x * 2
future = Task.run(get_result, 2)
res = future.result(timeout=1)
assert res == 4
@offload
def heavy_processing(x):
return x * 2
# blocking operation
res = heavy_processing(10)
assert res == 20
Check out tests
for more.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
offloading-2.0.0.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for offloading-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 327fa25faf5945ccfa9e643659f3948ed0f450aa27c9db752d5d60729680aff0 |
|
MD5 | 0a7c004d96b0e38252875d235a8759d8 |
|
BLAKE2b-256 | 5f3dc2d4fb291004d4c4384bf2965d2e109eaacf9853647ed5076070368c02a2 |