You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.Rmd
+56-18Lines changed: 56 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,23 @@ import ezpq
29
29
30
30
# `ezpq`: an easy parallel queueing system.
31
31
32
-
Read this on [GitHub](https://github.com/dm3ll3n/ezpq) or [my site](https://www.donaldmellenbruch.com/project/ezpq/).
32
+
> Read this on [GitHub](https://github.com/dm3ll3n/ezpq) or [my site](https://www.donaldmellenbruch.com/project/ezpq/).
33
+
34
+
## How to get it
35
+
36
+
Install from [PyPI](https://pypi.org/project/ezpq/) with:
37
+
38
+
```python
39
+
pip install ezpq
40
+
```
41
+
42
+
Optional packages:
43
+
44
+
```python
45
+
pip install pandas # required for plots
46
+
pip install plotnine # required for plots
47
+
pip install tqdm # required for progress bars
48
+
```
33
49
34
50
## Overview
35
51
@@ -59,22 +75,6 @@ The queueing system uses `multiprocessing.Process` by default and can also run j
59
75
* Built-in logging to CSV.
60
76
* Customizable visualizations of queue operations.
61
77
62
-
## How to get it
63
-
64
-
Install from [PyPI](https://pypi.org/project/ezpq/) with:
65
-
66
-
```python
67
-
pip install ezpq
68
-
```
69
-
70
-
Optional packages:
71
-
72
-
```python
73
-
pip install pandas # required for plots
74
-
pip install plotnine # required for plots
75
-
pip install tqdm # required for progress bars
76
-
```
77
-
78
78
## Quickstart
79
79
80
80
Suppose you wanted to speed up the following code, which runs 60 operations that take anywhere from 0s to 2s. With an average job time of ~1s, this operation should take ~60s.
@@ -311,6 +311,44 @@ with ezpq.Queue(6) as Q:
311
311
312
312

313
313
314
+
### starmap
315
+
316
+
`starmap` is similar to `map`, but operates on a list of lists, with each nested list being unpacked as arguments to the function.
317
+
318
+
```{python, echo=TRUE}
319
+
def my_pow(x, k):
320
+
return '{}^{} = {}'.format(x, k, x**k)
321
+
322
+
# list of lists to iterate over.
323
+
args_list = [[x, x%4] # (x, k)
324
+
for x in range(100)]
325
+
326
+
# starmap
327
+
with ezpq.Queue(10) as Q:
328
+
output = Q.starmap(my_pow, iterable=args_list)
329
+
330
+
[x['output'] for x in output[:10]]
331
+
```
332
+
333
+
### startmapkw
334
+
335
+
Same as `starmap`, but operations on a list of *dicts* to be expanded as kwargs to the function.
The queueing operations performed by `ezpq.Queue` are performed on a periodic basis. By default, the `poll` parameter for a Queue is `0.1` seconds. This "pulse" thread will continue firing until the Queue is disposed of.
@@ -336,7 +374,7 @@ In the above graphic, notice how same-colored bars never overlap. These bars rep
336
374
337
375
### Lane Error Handling
338
376
339
-
You may want to short-circuit a synchronous lane if a job in the lane fails. You can do this by specifying `skip_on_lane_error=True` when putting a job in the queue. If specified and the preceding job has a non-zero exit code, this job will not be run.
377
+
You may want to short-circuit a synchronous lane if a job in the lane fails. You can do this by specifying `stop_on_lane_error=True` when putting a job in the queue. If specified and the preceding job has a non-zero exit code, this job will not be run.
0 commit comments