From: Razvan Deaconescu Date: Fri, 6 Aug 2010 09:15:34 +0000 (+0300) Subject: ControlScripts: update scripts to be aware of pre-run and post-run scripts and scenar... X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=887640ad9195a1993e45b9f3c2cd62c0fedc5af8;p=p2p-testing-infrastructure.git ControlScripts: update scripts to be aware of pre-run and post-run scripts and scenario_config file --- diff --git a/ControlScripts/detect_complete_client.sh b/ControlScripts/detect_complete_client.sh index 638a206..19c44e8 100755 --- a/ControlScripts/detect_complete_client.sh +++ b/ControlScripts/detect_complete_client.sh @@ -11,18 +11,20 @@ # 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} diff --git a/ControlScripts/parse_client_log.sh b/ControlScripts/parse_client_log.sh index 13deef5..ff5f7d4 100755 --- a/ControlScripts/parse_client_log.sh +++ b/ControlScripts/parse_client_log.sh @@ -11,19 +11,21 @@ # 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} diff --git a/ControlScripts/parse_hrk.sh b/ControlScripts/parse_hrk.sh index b996e27..863e36d 100755 --- a/ControlScripts/parse_hrk.sh +++ b/ControlScripts/parse_hrk.sh @@ -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 diff --git a/ControlScripts/parse_leecher.sh b/ControlScripts/parse_leecher.sh index 32b476d..11974e8 100755 --- a/ControlScripts/parse_leecher.sh +++ b/ControlScripts/parse_leecher.sh @@ -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 diff --git a/ControlScripts/run_scenario.sh b/ControlScripts/run_scenario.sh index 60f8abd..67ecd33 100755 --- a/ControlScripts/run_scenario.sh +++ b/ControlScripts/run_scenario.sh @@ -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 diff --git a/ControlScripts/schedule_client.sh b/ControlScripts/schedule_client.sh index 3d82674..3ed77de 100755 --- a/ControlScripts/schedule_client.sh +++ b/ControlScripts/schedule_client.sh @@ -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 diff --git a/ControlScripts/start_doe.sh b/ControlScripts/start_doe.sh index 61cc7fd..948394b 100755 --- a/ControlScripts/start_doe.sh +++ b/ControlScripts/start_doe.sh @@ -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:. diff --git a/ControlScripts/start_hrk_leecher.sh b/ControlScripts/start_hrk_leecher.sh index 2a0c3f8..5e6dcc5 100755 --- a/ControlScripts/start_hrk_leecher.sh +++ b/ControlScripts/start_hrk_leecher.sh @@ -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/ diff --git a/ControlScripts/start_hrk_seeder.sh b/ControlScripts/start_hrk_seeder.sh index d6cf4d5..cf52388 100755 --- a/ControlScripts/start_hrk_seeder.sh +++ b/ControlScripts/start_hrk_seeder.sh @@ -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/ diff --git a/ControlScripts/start_leecher.sh b/ControlScripts/start_leecher.sh index c92dc74..785e9e3 100755 --- a/ControlScripts/start_leecher.sh +++ b/ControlScripts/start_leecher.sh @@ -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:. diff --git a/ControlScripts/start_proxy.sh b/ControlScripts/start_proxy.sh index 93cb40b..afff062 100755 --- a/ControlScripts/start_proxy.sh +++ b/ControlScripts/start_proxy.sh @@ -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 diff --git a/ControlScripts/start_seeder.sh b/ControlScripts/start_seeder.sh index b221760..fd65c89 100755 --- a/ControlScripts/start_seeder.sh +++ b/ControlScripts/start_seeder.sh @@ -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:. diff --git a/ControlScripts/start_tracker.sh b/ControlScripts/start_tracker.sh index fab5dad..c8058a9 100755 --- a/ControlScripts/start_tracker.sh +++ b/ControlScripts/start_tracker.sh @@ -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 diff --git a/ControlScripts/start_tribler.sh b/ControlScripts/start_tribler.sh index e3d8ea2..ca47186 100755 --- a/ControlScripts/start_tribler.sh +++ b/ControlScripts/start_tribler.sh @@ -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 diff --git a/ControlScripts/stop_client.sh b/ControlScripts/stop_client.sh index e3e679b..570deb3 100755 --- a/ControlScripts/stop_client.sh +++ b/ControlScripts/stop_client.sh @@ -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