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: CHANGELOG.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
4
4
5
5
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
7
+
## v0.2.1
8
+
9
+
### Added
10
+
11
+
-`clear_waiting()` function to clear the waiting queue.
12
+
- Added `stop_on_lane_error` parameter to `ezpq.Job` to allow for short-circuiting a synchronous lane if a job in the lane fails. When set to `True` and the preceding job has a non-zero exit code, this job will not be run. Note that this is to be set per-job for flexibility.
13
+
- Additional unit tests.
14
+
15
+
### Changed
16
+
17
+
-`stop_all()` function now clears the waiting queue and terminate running jobs. This addresses a bug where a queue would fail to close when disposing with jobs still in the waiting queue.
18
+
- The default `poll` for the queue itself is still `0.1`. Now, the default `poll` for `get` and `wait` is equal to the `poll` for the queue itself, as it makes no sense to check for changes more freqeuntly than changes could arise.
19
+
20
+
### Removed
21
+
22
+
- Removed functions `has_waiting`, `has_work`, and `has_completed`. Use `size(...)` for this.
23
+
- Renamed `Queue.is_started` to `Queue.is_running`.
Copy file name to clipboardExpand all lines: README.Rmd
+37-5Lines changed: 37 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,7 @@ def random_sleep(x):
90
90
return n
91
91
```
92
92
93
-
```{python, echo=TRUE}
93
+
```{python, echo=TRUE, eval=FALSE}
94
94
start = time.time()
95
95
96
96
output = [random_sleep(x) for x in range(60)]
@@ -100,9 +100,17 @@ end = time.time()
100
100
print('> Runtime: ' + str(end - start))
101
101
```
102
102
103
+
```
104
+
## '> Runtime: 58.932034969329834'
105
+
```
106
+
103
107
Here is the function ran in parallel with an `ezpq` Queue of 6 workers. Thus, the runtime of the above operation will be reduced from ~60s to ~10s.
104
108
105
109
```{python, eval=FALSE, echo=TRUE}
110
+
import time
111
+
import random
112
+
import ezpq
113
+
106
114
start = time.time()
107
115
108
116
with ezpq.Queue(6) as Q:
@@ -244,7 +252,7 @@ with ezpq.Queue(6) as Q:
244
252
Q.put(random_sleep, x)
245
253
246
254
# repeatedly print sizes until complete.
247
-
while Q.has_work():
255
+
while Q.size(waiting=True, working=True):
248
256
print_sizes(Q)
249
257
time.sleep(1)
250
258
@@ -253,7 +261,7 @@ with ezpq.Queue(6) as Q:
253
261
254
262
### wait
255
263
256
-
The `wait()` method will block execution until all jobs complete. It also accepts a `timeout` parameter, given in seconds. The return value is the count of jobs that did not complete. Thus, a return value greater than 0 indicates the timeout was exceeded. The parameter `poll` can be used to adjust how frequently (in seconds) the operation checks for completed jobs (default=0.1).
264
+
The `wait()` method will block execution until all jobs complete. It also accepts a `timeout` parameter, given in seconds. The return value is the count of jobs that did not complete. Thus, a return value greater than 0 indicates the timeout was exceeded. The parameter `poll` can be used to adjust how frequently (in seconds) the operation checks for completed jobs.
257
265
258
266
New in v0.2.0, include `show_progress=True` to show a progress bar while waiting. This is equivalent to a call to `waitpb()`.
259
267
@@ -262,7 +270,7 @@ New in v0.2.0, include `show_progress=True` to show a progress bar while waiting
262
270
263
271
### get
264
272
265
-
`get()` retrieves and deletes ("pop") the highest priority job from the completed queue, if one is available. If the completed queue is empty, `get()` returns `None`. However, `get()` will wait for a completed job if the`poll` frequency is greater than 0. If the timeout is exceeded, `None` is returned.
273
+
`get()` retrieves and deletes ("pop") the highest priority job from the completed queue, if one is available. If the completed queue is empty, `get()` returns `None`. However, `get()` will wait for a completed job if `wait`,`poll`, or `timeout` are specified. If the timeout is exceeded, `None` is returned.
266
274
267
275
```{python, echo=TRUE}
268
276
with ezpq.Queue(6) as Q:
@@ -274,7 +282,7 @@ with ezpq.Queue(6) as Q:
274
282
275
283
# repeatedly `get()` until queue is empty.
276
284
for i in range(n_inputs):
277
-
output[i] = Q.get(poll=0.1)
285
+
output[i] = Q.get(wait=True)
278
286
```
279
287
280
288
### collect
@@ -326,6 +334,30 @@ When you have jobs that are dependent upon another, you can use "lanes" to execu
326
334
327
335
In the above graphic, notice how same-colored bars never overlap. These bars represent jobs that are in the same lane, which executed synchronously.
328
336
337
+
### Lane Error Handling
338
+
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.
The `Plot` class is used to visualize the wait, start, and end times for each job that entered the queueing system. The class is initialized with a list of dicts; exactly what is returned from a call to `collect()` or `map()`.
0 commit comments