From: Aleksander Mistewicz Date: Thu, 22 Dec 2016 11:43:54 +0000 (+0100) Subject: Add tsresults queue X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=323b03184e9c4ee1235b11aec55843b803833d95;p=tools%2Ftestlab%2Fmajor.git Add tsresults queue 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 --- diff --git a/tsp/common.sh b/tsp/common.sh index 94f12cc..9bfc210 100755 --- a/tsp/common.sh +++ b/tsp/common.sh @@ -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() { diff --git a/tsp/jobs/publish.sh b/tsp/jobs/publish.sh index 2df6631..9d5452c 100755 --- a/tsp/jobs/publish.sh +++ b/tsp/jobs/publish.sh @@ -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" diff --git a/tsp/jobs/update_db.sh b/tsp/jobs/update_db.sh index a87e834..ec9f679 100755 --- a/tsp/jobs/update_db.sh +++ b/tsp/jobs/update_db.sh @@ -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}" diff --git a/tsp/jobs/update_www.sh b/tsp/jobs/update_www.sh index 41676e1..06af2fb 100755 --- a/tsp/jobs/update_www.sh +++ b/tsp/jobs/update_www.sh @@ -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}"