From ba657c4df4947b64caf537e36e2ff32e7e5e1281 Mon Sep 17 00:00:00 2001 From: Aleksander Mistewicz Date: Mon, 23 Oct 2017 12:08:47 +0200 Subject: [PATCH] Add trigger_if_not_queued to watcher Sometimes a lot of jobs are queued when one of them is being blocked. As it happens more often (and is disruptive for the service) no new jobs will be queued. Change-Id: If4f1db051a3e58c81ffdc777675773f1cd88b6be --- tsp/watchers/watcher.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/tsp/watchers/watcher.sh b/tsp/watchers/watcher.sh index b8b8977..c1fbe29 100755 --- a/tsp/watchers/watcher.sh +++ b/tsp/watchers/watcher.sh @@ -20,12 +20,19 @@ export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.." . "${TSP_DIR}/common.sh" +trigger_if_not_queued() { + LABEL="$1" + URL="$2" + test -z "$(tspoll | awk -v LABEL="$LABEL" '$2 ~ "queued" && $0 ~ LABEL {print $1}')" &&\ + tspoll -L "$LABEL" sh "${TSP_DIR}/jobs/trigger_downloads.sh" "$URL" "$3" +} + # Dispatch tsp/jobs/trigger_downloads.sh for common snapshot and prerelease urls -tspoll -L 4_SNAPSHOT sh "${TSP_DIR}/jobs/trigger_downloads.sh" "http://download.tizen.org/snapshots/tizen/common/" tizen_4.0_snapshot -tspoll -L 4_PRERELEASE sh "${TSP_DIR}/jobs/trigger_downloads.sh" "http://download.tizen.org/prerelease/tizen/common/" tizen_4.0_prerelease -tspoll -L 3_SNAPSHOT sh "${TSP_DIR}/jobs/trigger_downloads.sh" "http://download.tizen.org/snapshots/tizen/3.0-common/" tizen_3.0_snapshot -tspoll -L 3_PRERELEASE sh "${TSP_DIR}/jobs/trigger_downloads.sh" "http://download.tizen.org/prerelease/tizen/3.0-common/" tizen_3.0_prerelease -tspoll -L UNI_SNAPSHOT sh "${TSP_DIR}/jobs/trigger_downloads.sh" "http://download.tizen.org/snapshots/tizen/unified/" tizen_uni_snapshot -tspoll -L UNI_PRERELEASE sh "${TSP_DIR}/jobs/trigger_downloads.sh" "http://download.tizen.org/prerelease/tizen/unified/" tizen_uni_prerelease -tspoll -L UNI4_SNAPSHOT sh "${TSP_DIR}/jobs/trigger_downloads.sh" "http://download.tizen.org/snapshots/tizen/4.0-unified/" tizen_4.0_uni_snapshot -tspoll -L UNI4_PRERELEASE sh "${TSP_DIR}/jobs/trigger_downloads.sh" "http://download.tizen.org/prerelease/tizen/4.0-unified/" tizen_4.0_uni_prerelease +trigger_if_not_queued 4_SNAPSHOT "http://download.tizen.org/snapshots/tizen/common/" tizen_4.0_snapshot +trigger_if_not_queued 4_PRERELEASE "http://download.tizen.org/prerelease/tizen/common/" tizen_4.0_prerelease +trigger_if_not_queued 3_SNAPSHOT "http://download.tizen.org/snapshots/tizen/3.0-common/" tizen_3.0_snapshot +trigger_if_not_queued 3_PRERELEASE "http://download.tizen.org/prerelease/tizen/3.0-common/" tizen_3.0_prerelease +trigger_if_not_queued UNI_SNAPSHOT "http://download.tizen.org/snapshots/tizen/unified/" tizen_uni_snapshot +trigger_if_not_queued UNI_PRERELEASE "http://download.tizen.org/prerelease/tizen/unified/" tizen_uni_prerelease +trigger_if_not_queued UNI4_SNAPSHOT "http://download.tizen.org/snapshots/tizen/4.0-unified/" tizen_4.0_uni_snapshot +trigger_if_not_queued UNI4_PRERELEASE "http://download.tizen.org/prerelease/tizen/4.0-unified/" tizen_4.0_uni_prerelease -- 2.7.4