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
The `put` method creates a job and submits it to an `ezpq` queue. All of its arguments are passed to `ezpq.Job()`.
215
216
@@ -221,7 +222,7 @@ with ezpq.Queue(6) as Q:
221
222
output = Q.collect()
222
223
```
223
224
224
-
### `size`
225
+
### size
225
226
226
227
`size()` returns a count of all items across all three queue components. It accepts three boolean parameters, `waiting`, `working`, and `completed`. If all of these are `False` (default), all jobs are counted. If any combination of these is `True`, only the corresponding queue(s) will be counted. For example:
227
228
@@ -250,7 +251,7 @@ with ezpq.Queue(6) as Q:
250
251
print_sizes(Q)
251
252
```
252
253
253
-
### `wait`
254
+
### wait
254
255
255
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).
256
257
@@ -259,7 +260,7 @@ New in v0.2.0, include `show_progress=True` to show a progress bar while waiting
259
260

260
261
261
262
262
-
### `get`
263
+
### get
263
264
264
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.
265
266
@@ -271,12 +272,12 @@ with ezpq.Queue(6) as Q:
271
272
for x in range(n_inputs):
272
273
Q.put(random_sleep, args=x)
273
274
274
-
# repeatedly `get()` queue is empty.
275
+
# repeatedly `get()` until queue is empty.
275
276
for i in range(n_inputs):
276
277
output[i] = Q.get(poll=0.1)
277
278
```
278
279
279
-
### `collect`
280
+
### collect
280
281
281
282
`collect()` is similar to `get()`, but it will return a list of *all* completed jobs and clear the completed queue. It does not support the `poll` or `timeout` parameters, but you can call `wait()` before `collect()` if desired.
282
283
@@ -296,13 +297,13 @@ with ezpq.Queue(6) as Q:
296
297
print('Output size: {0}'.format(len(output)))
297
298
```
298
299
299
-
### `map`
300
+
### map
300
301
301
302
`map` encapsulates the logic of `put`, `wait`, and `collect` in one call. Include `show_progress=True` to get output `tqdm` progress bar.
302
303
303
304

304
305
305
-
### `dispose`
306
+
### dispose
306
307
307
308
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.
308
309
@@ -325,7 +326,7 @@ When you have jobs that are dependent upon another, you can use "lanes" to execu
325
326
326
327
In the above graphic, notice how same-colored bars never overlap. These bars represent jobs that are in the same lane, which executed synchronously.
327
328
328
-
## `ezpq.Plot`
329
+
## ezpq.Plot
329
330
330
331
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