|
1 | 1 | # process-queue :train: |
2 | 2 |
|
| 3 | +process-queue is a tool for queuing sequential program executions using |
| 4 | +different sets of arguments. |
| 5 | + |
| 6 | +## Examples |
| 7 | + |
| 8 | +process-queue server can be started with the `server` sub-command. In this |
| 9 | +example, we start a pqueue server that will execute `echo` with two arguments, |
| 10 | +"Hello" and one supplied by the sender. |
| 11 | + |
| 12 | + pqueue server echo Hello {} |
| 13 | + |
| 14 | +Once the server is listening we can start sending in jobs by running: |
| 15 | + |
| 16 | + pqueue send world |
| 17 | + |
| 18 | +We can see the string "Hello world" got printed in the terminal running the |
| 19 | +server. The server will keep listening for new jobs, if we now execute: |
| 20 | + |
| 21 | + pqueue send "John Doe" |
| 22 | + |
| 23 | +We will see "Hello John Doe" printed as expected. Where `pqueue` comes in handy |
| 24 | +is when dealing with long running jobs. Since the jobs are queued one can send |
| 25 | +in new a job even if the server is still executing an earlier program. All the |
| 26 | +jobs are stored in a queue and executed sequentially in first-come, first-served |
| 27 | +basis. For example, we can start a new server named "timers": |
| 28 | + |
| 29 | + pqueue server -n timers sleep {} |
| 30 | + |
| 31 | +After this, we can send in a bunch of jobs: |
| 32 | + |
| 33 | + pqueue send -n timers 10 |
| 34 | + pqueue send -n timers 4 |
| 35 | + pqueue send -n timers 20 |
| 36 | + |
| 37 | +The tasks will execute one after another. |
| 38 | + |
| 39 | +## Dependencies |
| 40 | + |
| 41 | +process-queue uses DBus for IPC and |
| 42 | +needs [`libdbus`](https://dbus.freedesktop.org/releases/dbus/) 1.6 or higher. |
0 commit comments