swift client integration update -- *.log.mon file generation; *.log.data file generat...
authorP2P-Next User <p2p@p2p-next-04-201.grid.pub.ro>
Wed, 24 Nov 2010 10:42:01 +0000 (12:42 +0200)
committerP2P-Next User <p2p@p2p-next-04-201.grid.pub.ro>
Wed, 24 Nov 2010 10:42:01 +0000 (12:42 +0200)
ControlScripts/client_script_mappings
ControlScripts/clients/swift/start_swift_leecher.sh
ControlScripts/hook_monitor_pid.sh
ControlScripts/schedule_client.sh

index e483efd..ffd19ec 100644 (file)
@@ -190,5 +190,8 @@ parse_client_log()
                "tribler_proxy_04")
                        clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
                        ;;
+               "swift_seeder" | "swift_leecher")
+                       clients/swift/parse_swift.sh ${log_folder} ${log_file}
+                       ;;
        esac
 }
index 3fd34fe..e3e723a 100755 (executable)
@@ -36,4 +36,12 @@ cd $SWIFT_ABS_PATH
 echo ./swift -h "$HASH" -t "${TRACKER_IP}:6881" -p > ~/deb
 ./swift -h "$HASH" -t "${TRACKER_IP}:6881" -p
 
+#
+#./swift -h "$HASH" -t "${TRACKER_IP}:6881" -p &
+# ps -ef | grep shedule bla bla # proper way of determining PID of schedule (master) process
+# kill -USR1 $SCHEDULE_PID # SCHEDULE_PID is pid for master process
+#
+# wait # wait for client process to complete
+#
+
 rm -f ${HASH}*
index 7bff3c6..b336789 100755 (executable)
@@ -18,6 +18,7 @@ pid=$1
 kill -0 $pid > /dev/null 2>&1
 if test $? -ne 0; then
        echo -e "PID $pid does not exists.\nUsage: $0 <pid>" 1>&2
+       ps -ef
        exit 1
 fi
 
index 42d78a0..0bf2078 100755 (executable)
@@ -79,6 +79,15 @@ test_infinite()
        fi
 }
 
+cleanup()
+{
+       stop_client ${CLIENT_TYPE}
+       kill ${mon_pid}
+}
+
+# use cleanup function when receiving signals
+trap cleanup 0 1 2 3 15
+
 parse_periods
 
 DEBUG echo "start_time is ${start_time}"
@@ -96,8 +105,25 @@ DEBUG echo "CLIENT_TYPE is ${CLIENT_TYPE}"
 start_client ${CLIENT_TYPE} ${DL_BW} ${UL_BW} ${NO_CONNECTIONS}
 background_pid=$!
 DEBUG echo "background_pid is ${background_pid}"
+
+# wait_for_usr1()
+# {
+#   # do nothing, successfully
+# }
+#
+# trap wait_for_usr1 10 # wait_for_usr1 is simple handler (waits for SIGUSR1 from start_client process)
+#
+
+sleep 5
+client_pid=$(pgrep -P ${background_pid})
+DEBUG echo "client_pid is ${client_pid}"
 old_time=${start_time}
 
+# Monitor client's resources
+echo "$client_pid"
+./hook_monitor_pid.sh "$client_pid" >> $REMOTE_PATH/P2P-Testing-Infrastructure/ClientWorkingFolders/TmpLogs/$(hostname).log.mon 2>&1 &
+mon_pid=$!
+
 for ((i = 0; i < ${#suspend_resume[@]}; i += 2)); do
        # Sleeping while the client runs. When i wake up i will suspend the client
        test_infinite ${suspend_resume[$i]}
@@ -108,10 +134,7 @@ for ((i = 0; i < ${#suspend_resume[@]}; i += 2)); do
        DEBUG echo "client_pid is ${client_pid}"
        suspend_client ${client_pid}
        old_time=${suspend_resume[$i]}
-
-       # Monitor client's resources
-       ./hook_monitor_pid $client_pid >> $REMOTE_PATH/P2P-Testing-Infrastructure/ClientWorkingFolders/TmpLogs/\$(hostname).log.mon 2>&1 &
-
+       
        # Client is suspended. Sleeping until the client should be restarted. When i wake up i will start the client
        test_infinite ${suspend_resume[$(($i+1))]}
 
@@ -128,4 +151,6 @@ test_infinite ${stop_time}
 
 to_sleep=$((${stop_time} - ${old_time}))
 sleep ${to_sleep}
-stop_client ${CLIENT_TYPE}
+
+# stop client and monitoring script
+cleanup