From: Aleksander Mistewicz Date: Tue, 26 Jul 2016 12:45:20 +0000 (+0200) Subject: Add tsp/stop.sh X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=25470c9f2dde4a249f83afc218a07ca02455fbd5;p=tools%2Ftestlab%2Fmajor.git Add tsp/stop.sh To stop TITS run: ./tsp/stop.sh Steps are: * remove crontab * save currently dispatched urls * for tsmaster, tspoll, tspwb: ** remove queued jobs ** kill running jobs ** kill the server * for tsrun_target queues: ** remove queued jobs ** wait for running jobs ** kill the server To start TITS run: crontab tsp/cronfile.example Change-Id: I051a9ddcec0093c1fae3888ec9a9b438b73f5bb3 Signed-off-by: Aleksander Mistewicz --- diff --git a/tsp/jobs/trigger_downloads.sh b/tsp/jobs/trigger_downloads.sh index deed3d8..0155397 100755 --- a/tsp/jobs/trigger_downloads.sh +++ b/tsp/jobs/trigger_downloads.sh @@ -25,7 +25,7 @@ cd "${WS_WATCHER}" touch next_dwn i=$(cat next_dwn) test -n "$i" || i=1 -for url in $(cat modified_urls) +for url in $(cat modified_urls manual_urls | sort -u) do echo "Processing: ${url}" if [ $url = "*latest*" ] @@ -47,4 +47,6 @@ do i=$((i+1)) done done -echo "$i" > "${WS_WATCHER}/next_dwn" +cd "${WS_WATCHER}" +echo "$i" > "next_dwn" +rm -f manual_urls diff --git a/tsp/stop.sh b/tsp/stop.sh new file mode 100755 index 0000000..77e727b --- /dev/null +++ b/tsp/stop.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Author: Aleksander Mistewicz + +export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)" + +. "${TSP_DIR}/common.sh" + +echo "Remove crontab" +crontab -r + +kill_running() { + echo "[$@] Kill every running job" + for i in $(eval $@ | grep "running" | grep -o "^[0-9]*") + do + kill `eval $@ -p $i` + done +} + +remove_queued() { + echo "[$@] Remove every queued job" + for i in $(eval $@ | grep "queued" | grep -o "^[0-9]*") + do + eval $@ -r $i + done +} + +echo "Save dispatched SRs" + +tsmaster | grep "running\|queued" | grep -o "http://.*/" | sort -u >> "${WS_WATCHER}/manual_urls" + +echo "Stop master queues" + +for queue in "tsmaster" "tspoll" "tspwb" +do + remove_queued $queue + kill_running $queue + echo "[$queue] Kill server" + eval $queue -K +done + +echo "Stop runner queues" +echo "Queued tests will be lost" + +for target in "odroid" "minnow32" "minnow64" +do + remove_queued tsrun_target $target +done + +echo "Wait for last tests to finish and kill server" + +for target in "odroid" "minnow32" "minnow64" +do + echo "[$target] wait for running job" + tsrun_target $target -w + echo "[$target] Kill server" + tsrun_target $target -K +done