Asinoyx is a package which can simplify your multiprocessing implementation
Project description
Acinonyx
Asinoyx is a package which can simplify your multiprocessing implementation, also you can easily watch the progress of multiprocessing execution.
Usage
A simple sample:
import time
from random import random
from acinonyx import run
def log(val):
time.sleep(random())
return val
values = range(100)
print(run(log, values))
It will run with cpu_count processes and print progress bar, output is below:
1%|█ | 1/100 [00:01<00:40, 2.29it/s]
26%|██ | 26/100 [00:01<00:32, 21.29it/s]
100%|██████████| 100/100 [00:03<00:00, 26.86it/s]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ..., 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]
Also you can use multiple args:
import time
from random import random
from acinonyx import run
def add(a, b):
time.sleep(random())
return a + b
if __name__ == '__main__':
values = [(i, i) for i in range(100)]
print(run(add, values))
Also you can use it in other scenario such as web spider:
import requests
from random import random
import time
from acinonyx import irun
def fetch():
delay = random()
url = 'https://httpbin.org/uuid'
time.sleep(delay)
return requests.get(url).json().get('uuid')
if __name__ == '__main__':
for result in irun(fetch, range(10), ordered=False):
print(result)
Trouble Shooting
NSPlaceholderDate initialize error
objc[67206]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called
Try to set env before execute script:
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file acinonyx-0.1.0.tar.gz.
File metadata
- Download URL: acinonyx-0.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07be7398ba9575316f02bce6620f5dd98c141a11bc2f0823d123a588d55dd66f
|
|
| MD5 |
82560fa7f3620da708352b51fd7003d8
|
|
| BLAKE2b-256 |
581ccf0916aabc9d3736d8407ae3b85420d0b6de4f1e666783ad2339e78da219
|
File details
Details for the file acinonyx-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: acinonyx-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1c4809720c51e34f59df041212cebc10308efe555e92c04c92bc721992c2ed8
|
|
| MD5 |
35f709e3533176173bb7261de4f3f44e
|
|
| BLAKE2b-256 |
51f15d433d2f0d548dd210abcf9d3d0009b966c6d7480133e0bac5b396bc8b8f
|