ControlScripts: update scripts to be aware of pre-run and post-run scripts and scenar...
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Fri, 6 Aug 2010 09:15:34 +0000 (12:15 +0300)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Fri, 6 Aug 2010 09:15:34 +0000 (12:15 +0300)
15 files changed:
ControlScripts/detect_complete_client.sh
ControlScripts/parse_client_log.sh
ControlScripts/parse_hrk.sh
ControlScripts/parse_leecher.sh
ControlScripts/run_scenario.sh
ControlScripts/schedule_client.sh
ControlScripts/start_doe.sh
ControlScripts/start_hrk_leecher.sh
ControlScripts/start_hrk_seeder.sh
ControlScripts/start_leecher.sh
ControlScripts/start_proxy.sh
ControlScripts/start_seeder.sh
ControlScripts/start_tracker.sh
ControlScripts/start_tribler.sh
ControlScripts/stop_client.sh

index 638a206..19c44e8 100755 (executable)
 # use _DEBUG="off" to turn off debug printing
 _DEBUG="on"
 
-if test $# -ne 2; then
-       echo "usage: $0 client-type log-file" 1>&2
+if test $# -ne 1; then
+       echo "usage: $0 log-file" 1>&2
        exit 1
 fi
 
 # Read the global configuration variables
 source ../ConfigFiles/globalconfig.txt
 
+# Read scenarion configuration file (CLIENT_TYPE)
+source ${BASE_PATH}/ClientWorkingFolders/TmpLogs/scenario_config
+
 # Read client mappings configuration file
 source ../ConfigFiles/client_script_mappings
 
-client_type=$1
-log_file=$2
+log_file=$1
 
-detect_complete_client ${client_type} ${log_file}
+detect_complete_client ${CLIENT_TYPE} ${log_file}
index 13deef5..ff5f7d4 100755 (executable)
 # use _DEBUG="off" to turn off debug printing
 _DEBUG="on"
 
-if test $# -ne 3; then
-       echo "usage: $0 client-type log-folder log-file" 1>&2
+if test $# -ne 2; then
+       echo "usage: $0 log-folder log-file" 1>&2
        exit 1
 fi
 
 # Read the global configuration variables
 source ../ConfigFiles/globalconfig.txt
 
+# Read scenarion configuration file (CLIENT_TYPE)
+source ${BASE_PATH}/ClientWorkingFolders/TmpLogs/scenario_config
+
 # Read client mappings configuration file
 source ../ConfigFiles/client_script_mappings
 
-client_type=$1
-log_folder=$2
-log_file=$3
+log_folder=$1
+log_file=$2
 
-parse_client_log ${client_type} ${log_folder} ${log_file}
+parse_client_log ${CLIENT_TYPE} ${log_folder} ${log_file}
index b996e27..863e36d 100755 (executable)
@@ -2,9 +2,7 @@
 #
 # 2010 Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
 #
-# Bash script used to parse the log file generated by a seeder client and to generate a data file
-# The script
-#  * TODO
+# Bash script used to parse the log file generated by a hrk client
 #
 # Script arguments:
 #  * a folder where the log and data files are stored
index 32b476d..11974e8 100755 (executable)
@@ -2,9 +2,8 @@
 #
 # Copyright: George Milescu 2010 - george.milescu@gmail.com
 #
-# Bash script used to parse the log file generated by a regular (leecher) client and to generate a data file
-# The script
-#  * TODO
+# Bash script used to parse the log file generated by a regular
+#(leecher) client and to generate a data file
 #
 # Script arguments:
 #  * a folder where the log and data files are stored
index 60f8abd..67ecd33 100755 (executable)
@@ -137,7 +137,7 @@ scenario_schedule()
        echo "---------------------- scenario_schedule" >> $ERR_LOG
        while IFS=$'\t' read SERVER PORT USER REMOTE_PATH REMOTE_IF DL_BW DL_BURST UL_BW UL_BURST PRE_RUN_SCRIPT POST_RUN_SCRIPT CLIENT_TYPE TORRENT_FILE PERIODS; do
                echo " ** Scheduling $SERVER:$PORT"
-               if ! ssh -f -p $PORT ${USER}@${SERVER} "cd $REMOTE_PATH/P2P-Testing-Infrastructure/ControlScripts; ./schedule_client.sh ${CLIENT_TYPE} ${TORRENT_FILE} \"${PERIODS}\" &> $REMOTE_PATH/P2P-Testing-Infrastructure/ClientWorkingFolders/TmpLogs/\$(hostname).log" &>> $ERR_LOG; then
+               if ! ssh -f -p $PORT ${USER}@${SERVER} "cd $REMOTE_PATH/P2P-Testing-Infrastructure/ControlScripts; ./schedule_client.sh &> $REMOTE_PATH/P2P-Testing-Infrastructure/ClientWorkingFolders/TmpLogs/\$(hostname).log" &>> $ERR_LOG; then
                        echo "Error: error running client_schedule.sh on $SERVER"
                        break
                fi
@@ -156,7 +156,7 @@ scenario_wait() {
                # Start the scripts on the remote clients
                # -n is used to redirect the ssh stdin from /dev/null, in order to keep the stdin in place for the read command
                # The ssh call is blocking
-               if ! ssh -n -p $PORT ${USER}@${SERVER} "cd $REMOTE_PATH/P2P-Testing-Infrastructure/ControlScripts; ./detect_complete_client.sh ${CLIENT_TYPE} $REMOTE_PATH/P2P-Testing-Infrastructure/ClientWorkingFolders/TmpLogs/\$(hostname).log" &>> $ERR_LOG; then
+               if ! ssh -n -p $PORT ${USER}@${SERVER} "cd $REMOTE_PATH/P2P-Testing-Infrastructure/ControlScripts; ./detect_complete_client.sh $REMOTE_PATH/P2P-Testing-Infrastructure/ClientWorkingFolders/TmpLogs/\$(hostname).log" &>> $ERR_LOG; then
                        echo "Error: error while waiting for client on $SERVER to finish"
                        break
                fi
@@ -174,7 +174,7 @@ scenario_clean() {
 
                # stopping the client on the server
                # -n is used to redirect the ssh stdin from /dev/null, in order to keep the stdin in place for the read command
-               if ! ssh -n -p $PORT ${USER}@${SERVER} "cd $REMOTE_PATH/P2P-Testing-Infrastructure/ControlScripts; ./stop_client.sh ${CLIENT_TYPE}" &>> $ERR_LOG; then
+               if ! ssh -n -p $PORT ${USER}@${SERVER} "cd $REMOTE_PATH/P2P-Testing-Infrastructure/ControlScripts; ./stop_client.sh" &>> $ERR_LOG; then
                        echo "Error: error stopping client on $SERVER"
                fi
                # wait for the remote client to finish completly
@@ -214,7 +214,7 @@ scenario_parse() {
 
                echo " with hostname $REMOTE_HOSTNAME"
 
-               if ! ./parse_client_log.sh ${CLIENT_TYPE} $SCENARIO_RESULTS_FOLDER ${REMOTE_HOSTNAME}.log; then
+               if ! ./parse_client_log.sh $SCENARIO_RESULTS_FOLDER ${REMOTE_HOSTNAME}.log; then
                        echo "Error parsing file $SCENARIO_RESULTS_FOLDER/${REMOTE_HOSTNAME}.log"
                        exit 1
                fi
index 3d82674..3ed77de 100755 (executable)
@@ -15,23 +15,15 @@ DEBUG()
        test ${_DEBUG} = "on" && $@
 }
 
-if test $# -lt 3; then
-       echo "usage: $0 client-type torrent-file periods" 1>&2
-       exit 1
-fi
-
 # Read the global configuration variables
 source ../ConfigFiles/globalconfig.txt
 
+# Read scenarion configuration file
+source ${BASE_PATH}/ClientWorkingFolders/TmpLogs/scenario_config
+
 # Read client mappings configuration file
 source ../ConfigFiles/client_script_mappings
 
-client_type=$1
-torrent_file=$2
-
-shift 2
-periods=$@
-
 client_pid=0
 
 declare start_time
@@ -40,7 +32,7 @@ declare -a suspend_resume
 
 parse_periods()
 {
-       local tmp_array=($(echo "$periods" | sed 's/[,()]/ /g'))
+       local tmp_array=($(echo "$PERIODS" | sed 's/[,()]/ /g'))
        start_time=${tmp_array[0]}
        local len=${#tmp_array[@]}
 
@@ -84,7 +76,7 @@ DEBUG echo "stop_time is ${stop_time}"
 
 to_sleep=${start_time}
 sleep ${to_sleep}
-start_client ${client_type} ${torrent_file}
+start_client
 background_pid=$!
 DEBUG echo "background_pid is ${background_pid}"
 old_time=${start_time}
@@ -111,4 +103,4 @@ test_infinite ${stop_time}
 
 to_sleep=$((${stop_time} - ${old_time}))
 sleep ${to_sleep}
-stop_client ${client_type}
+stop_client
index 61cc7fd..948394b 100755 (executable)
@@ -7,20 +7,12 @@
 #  * changes current working directory to proxyservice-m32
 #  * starts a tribler cmd-line instance with the supplied .torrent file. The .torrent file must be located in the TorrentsAndData folder
 #  * at the end deletes the downloaded data
-#
-# Script arguments:
-#  * .torrent file
-
-if [ ! $# -eq 1 ]; then
-       echo "usage: $0 torrent-file"
-       exit 1
-fi
 
 # Read the global configuration variables
 source ../ConfigFiles/globalconfig.txt
 
-# Read arguments
-TORRENT_FILE=$1
+# Read scenarion configuration file (TORRENT_FILE)
+source ${BASE_PATH}/ClientWorkingFolders/TmpLogs/scenario_config
 
 export PYTHONPATH=$PYTHONPATH:.
 
index 2a0c3f8..5e6dcc5 100755 (executable)
@@ -8,20 +8,15 @@
 #  * starts a hrktorrent session - use LD_LIBRARY_PATH to point to
 #    libtorrent-rasterbar location
 #  * at the end deletes the downloaded data
-#
-# Script arguments:
-#  * .torrent file
-
-if [ ! $# -eq 1 ]; then
-       echo "usage: $0 torrent-file"
-       exit 1
-fi
 
 # Read the global configuration variables
 source ../ConfigFiles/globalconfig.txt
 
-# Read arguments
-TORRENT_FILE=$1
+# Read scenarion configuration file (TORRENT_FILE)
+source ${BASE_PATH}/ClientWorkingFolders/TmpLogs/scenario_config
+
+# Read the global configuration variables
+source ../ConfigFiles/globalconfig.txt
 
 cd $WORKING_FOLDER_REL_PATH/Regular/
 
index d6cf4d5..cf52388 100755 (executable)
@@ -8,20 +8,12 @@
 #  * starts a hrktorrent session - use LD_LIBRARY_PATH to point to
 #    libtorrent-rasterbar location
 #  * at the end deletes the downloaded data
-#
-# Script arguments:
-#  * .torrent file
-
-if [ ! $# -eq 1 ]; then
-       echo "usage: $0 torrent-file"
-       exit 1
-fi
 
 # Read the global configuration variables
 source ../ConfigFiles/globalconfig.txt
 
-# Read arguments
-TORRENT_FILE=$1
+# Read scenarion configuration file (TORRENT_FILE)
+source ${BASE_PATH}/ClientWorkingFolders/TmpLogs/scenario_config
 
 cd $WORKING_FOLDER_REL_PATH/TorrentsAndData/
 
index c92dc74..785e9e3 100755 (executable)
@@ -7,20 +7,12 @@
 #  * changes current working directory to proxyservice-m32
 #  * starts a tribler cmd-line instance with the supplied .torrent file. The .torrent file must be located in the TorrentsAndData folder
 #  * at the end deletes the downloaded data
-#
-# Script arguments:
-#  * .torrent file
-
-if [ ! $# -eq 1 ]; then
-       echo "usage: $0 torrent-file"
-       exit 1
-fi
 
 # Read the global configuration variables
 source ../ConfigFiles/globalconfig.txt
 
-# Read arguments
-TORRENT_FILE=$1
+# Read scenarion configuration file (TORRENT_FILE)
+source ${BASE_PATH}/ClientWorkingFolders/TmpLogs/scenario_config
 
 export PYTHONPATH=$PYTHONPATH:.
 
index 93cb40b..afff062 100755 (executable)
@@ -19,6 +19,9 @@ fi
 # Read the global configuration variables
 source ../ConfigFiles/globalconfig.txt
 
+# Read scenarion configuration file
+source ${BASE_PATH}/ClientWorkingFolders/TmpLogs/scenario_config
+
 # Read arguments
 PROXY_NO=$1
 
index b221760..fd65c89 100755 (executable)
@@ -6,20 +6,12 @@
 # The script
 #  * changes current working directory to proxyservice-m32
 #  * starts a command line BT client seeding the supplied .torrent file. The .torrent file must be located in the TorrentsAndData folder
-#
-# Script arguments:
-#  * .torrent file
-
-if [ ! $# -eq 1 ]; then
-       echo "usage: $0 torrent-file"
-       exit 1
-fi
 
 # Read the global configuration variables
 source ../ConfigFiles/globalconfig.txt
 
-# Read arguments
-TORRENT_FILE=$1
+# Read scenarion configuration file (TORRENT_FILE)
+source ${BASE_PATH}/ClientWorkingFolders/TmpLogs/scenario_config
 
 export PYTHONPATH=$PYTHONPATH:.
 
index fab5dad..c8058a9 100755 (executable)
@@ -10,6 +10,9 @@
 # Read the global configuration variables
 source ../ConfigFiles/globalconfig.txt
 
+# Read scenarion configuration file
+source ${BASE_PATH}/ClientWorkingFolders/TmpLogs/scenario_config
+
 export PYTHONPATH=$PYTHONPATH:.
 
 cd $BITTORNADO_REL_PATH
index e3d8ea2..ca47186 100755 (executable)
@@ -10,6 +10,9 @@
 # Read the global configuration variables
 source ../ConfigFiles/globalconfig.txt
 
+# Read scenarion configuration file
+source ${BASE_PATH}/ClientWorkingFolders/TmpLogs/scenario_config
+
 export PYTHONPATH=$PYTHONPATH:.
 
 cd $TRIBLER_REL_PATH
index e3e679b..570deb3 100755 (executable)
@@ -6,25 +6,19 @@
 # The script
 #  * stops a client
 #  * stop schedule_client.sh script
-#
-# Command line argument specifies client type
 
 # use _DEBUG="off" to turn off debug printing
 _DEBUG="on"
 
-if test $# -ne 1; then
-       echo "usage: $0 client-type" 1>&2
-       exit 1
-fi
-
 # Read the global configuration variables
 source ../ConfigFiles/globalconfig.txt
 
+# Read scenarion configuration file (CLIENT_TYPE)
+source ${BASE_PATH}/ClientWorkingFolders/TmpLogs/scenario_config
+
 # Read client mappings configuration file
 source ../ConfigFiles/client_script_mappings
 
-client_type=$1
-
-stop_client ${client_type}
+stop_client ${CLIENT_TYPE}
 
 pkill -f schedule_client.sh