summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/olamic.install1
-rw-r--r--man/olamic-enqueue.1.md4
-rw-r--r--man/olamic-wait.1.md23
-rw-r--r--man/olamic-worker.8.md (renamed from man/olamic-worker.1.md)0
-rwxr-xr-xolamic-wait27
5 files changed, 53 insertions, 2 deletions
diff --git a/debian/olamic.install b/debian/olamic.install
index 6becfd7..d78041c 100644
--- a/debian/olamic.install
+++ b/debian/olamic.install
@@ -1,4 +1,5 @@
1examples /usr/share/doc/olamic 1examples /usr/share/doc/olamic
2olamic-enqueue /usr/bin 2olamic-enqueue /usr/bin
3olamic-wait /usr/bin
3olamic-worker /usr/bin 4olamic-worker /usr/bin
4pick-task /usr/share/olamic 5pick-task /usr/share/olamic
diff --git a/man/olamic-enqueue.1.md b/man/olamic-enqueue.1.md
index 15434cc..b52c6ed 100644
--- a/man/olamic-enqueue.1.md
+++ b/man/olamic-enqueue.1.md
@@ -1,6 +1,6 @@
1% OLAMIC-ENQUEUE(1) 1% OLAMIC-ENQUEUE(1)
2% Julian B Kongslie 2% Julian B Kongslie
3% October 2020 3% November 2020
4 4
5# NAME 5# NAME
6 6
@@ -21,4 +21,4 @@ When **olamic-enqueue** completes, it prints the UUID of the created task.
21 21
22# SEE ALSO 22# SEE ALSO
23 23
24olamic-worker(1) 24olamic-wait(1), olamic-worker(1)
diff --git a/man/olamic-wait.1.md b/man/olamic-wait.1.md
new file mode 100644
index 0000000..6e9e769
--- /dev/null
+++ b/man/olamic-wait.1.md
@@ -0,0 +1,23 @@
1% OLAMIC-WAIT(1)
2% Julian B Kongslie
3% November 2020
4
5# NAME
6
7olamic-wait - await completion of olamic task(s)
8
9# SYNOPSIS
10
11**olamic-wait** **/path/to/queue** **UUID** [**UUID** ...]
12
13# DESCRIPTION
14
15**olamic-wait** waits for the completion of the specified olamic tasks. You may
16pass any number of UUIDs to it, and it will block until all those tasks have
17been removed from the queue.
18
19While it is running, various status messages are written to stdout.
20
21# SEE ALSO
22
23olamic-enqueue(1)
diff --git a/man/olamic-worker.1.md b/man/olamic-worker.8.md
index d558f47..d558f47 100644
--- a/man/olamic-worker.1.md
+++ b/man/olamic-worker.8.md
diff --git a/olamic-wait b/olamic-wait
new file mode 100755
index 0000000..557c80a
--- /dev/null
+++ b/olamic-wait
@@ -0,0 +1,27 @@
1#!/bin/bash
2
3set -eu
4
5QUEUE_DIR="$1"; shift
6
7WAIT_UUID=""
8while true; do
9 WAITING=false
10 for UUID in "$@"; do
11 if [[ -e "$QUEUE_DIR"/candidates/"$UUID" || -e "$QUEUE_DIR"/in-progress/"$UUID" ]]; then
12 WAITING=true
13 if [[ "$WAIT_UUID" != "$UUID" ]]; then
14 WAIT_UUID="$UUID"
15 echo "$(date -Iseconds) Waiting for: $UUID"
16 fi
17 break
18 else
19 echo "$(date -Iseconds) Complete: $UUID"
20 shift
21 fi
22 done
23 if ! $WAITING; then
24 break
25 fi
26 sleep 1
27done