Add tsresults queue 56/108756/3
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Thu, 22 Dec 2016 11:43:54 +0000 (12:43 +0100)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Wed, 1 Feb 2017 16:36:51 +0000 (17:36 +0100)
Do not urge tsresults UPDATE_DB job
Remove WWW jobs before dispatching a new one
Remove lockfile-progs dependency

Change-Id: I9732ae2aa59844ed5b6aafe0cfc0105436755235
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
tsp/common.sh
tsp/jobs/publish.sh
tsp/jobs/update_db.sh
tsp/jobs/update_www.sh

index 94f12cc..9bfc210 100755 (executable)
@@ -47,14 +47,17 @@ UPDATE_WWW="/var/tmp/should_update_www"
 TMP_POLL="/tmp/tl-master-poll"
 TMP_MASTER="/tmp/tl-master"
 TMP_PWB="/tmp/tl-pwb"
+TMP_PWB_RESULTS="/tmp/tl-pwb-results"
 
 test -d "$TMP_POLL" || mkdir "$TMP_POLL"
 test -d "$TMP_MASTER" || mkdir "$TMP_MASTER"
 test -d "$TMP_PWB" || mkdir "$TMP_PWB"
+test -d "$TMP_PWB_RESULTS" || mkdir "$TMP_PWB_RESULTS"
 
 alias tspoll="TMPDIR=$TMP_POLL TS_SLOTS=1 tsp"
 alias tsmaster="TMPDIR=$TMP_MASTER TS_SLOTS=100 tsp"
 alias tspwb="TMPDIR=$TMP_PWB TS_SLOTS=1 tsp"
+alias tsresults="TMPDIR=$TMP_PWB_RESULTS TS_SLOTS=1 tsp"
 
 init_db() {
     # Load schema
@@ -113,8 +116,7 @@ update_db() {
     test -n "$TAG" || die "Missing argument: tag"
     test -n "$BUILD_NR" || die "Missing argument: build_nr"
     test -n "$TARGET" || die "Missing argument: target"
-    nr="$(tspwb -L DB sh "${TSP_DIR}/jobs/update_db.sh" "$SR" "$TAG" "$BUILD_NR" "$TARGET")"
-    tspwb -u "$nr"
+    tsresults -L DB sh "${TSP_DIR}/jobs/update_db.sh" "$SR" "$TAG" "$BUILD_NR" "$TARGET"
 }
 
 get_userspace_dir() {
index 2df6631..9d5452c 100755 (executable)
@@ -153,4 +153,11 @@ echo "PROFILE: $PROFILE"
 # Publish to database
 update_db "$SR" "$AVOCADO_TAG" "$BUILD_NR" "$TARGET"
 
-tspwb -L WWW sh "${TSP_DIR}/jobs/update_www.sh"
+# Remove all queued WWW jobs
+for i in $(tsresults | grep "queued.*WWW" | grep -o "^[0-9]*")
+do
+    tsresults -r "$i"
+done
+
+# Dispatch a new one
+tsresults -L WWW sh "${TSP_DIR}/jobs/update_www.sh"
index a87e834..ec9f679 100755 (executable)
@@ -30,9 +30,7 @@ test -n "$TAG" || die "Missing argument: tag"
 test -n "$BUILD_NR" || die "Missing argument: build_nr"
 test -n "$TARGET" || die "Missing argument: target"
 
-lockfile-create --use-pid "${DBPATH}"
 sqlite3 "${DBPATH}" "insert into test values (NULL,'$SR', CURRENT_TIMESTAMP, $BUILD_NR,\
     (select r.rid from result r where r.rname='$TAG'),\
     (select d.did from device d where d.dname='$TARGET'));"
 echo "$SR;$TAG;$BUILD_NR;$TARGET" >> "${UPDATE_WWW}"
-lockfile-remove "${DBPATH}"
index 41676e1..06af2fb 100755 (executable)
@@ -20,14 +20,7 @@ export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.."
 
 . "${TSP_DIR}/common.sh"
 
-# {{{ DBPATH
-lockfile-create --use-pid "${DBPATH}"
-
-test -f "${UPDATE_WWW}" || {
-    # }}} DBPATH
-    lockfile-remove "${DBPATH}"
-    die "No need to update the webpage"
-}
+test -f "${UPDATE_WWW}" || die "No need to update the webpage" 0
 
 # Publish to www
 {
@@ -44,6 +37,3 @@ test -f "${UPDATE_WWW}" || {
 } > "${WWW_3_PUBLISH}"
 
 rm "${UPDATE_WWW}"
-
-# }}} DBPATH
-lockfile-remove "${DBPATH}"