[Swift-commit] r7627 - branches/release-0.95/bin

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Mon Mar 3 15:59:05 CST 2014


Author: davidk
Date: 2014-03-03 15:59:05 -0600 (Mon, 03 Mar 2014)
New Revision: 7627

Modified:
   branches/release-0.95/bin/start-coaster-service
Log:
Start SSH workers in parallel


Modified: branches/release-0.95/bin/start-coaster-service
===================================================================
--- branches/release-0.95/bin/start-coaster-service	2014-02-28 20:52:39 UTC (rev 7626)
+++ branches/release-0.95/bin/start-coaster-service	2014-03-03 21:59:05 UTC (rev 7627)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash 
 
 # Report a problem and exit
 crash()
@@ -23,6 +23,7 @@
    done
 }
 
+# Run command, log, and wait for completion
 run_command()
 {
    command="$@"
@@ -30,6 +31,7 @@
    $command >> $LOG 2>&1
 }
 
+# Log and run command in background
 run_command_bg()
 {
    command="$@"
@@ -41,6 +43,8 @@
 # Start SSH workers
 start-workers-ssh()
 {
+   waitpids=""
+
    for MACHINE in $WORKER_HOSTS
    do
       # Enable ssh tunneling if needed
@@ -49,11 +53,15 @@
       fi
 
       # Connect directly
-      run_command ssh $WORKER_USERNAME@$MACHINE mkdir -p $WORKER_LOCATION
-      run_command scp $WORKER $WORKER_USERNAME@$MACHINE:$WORKER_LOCATION
       echo Starting worker on $MACHINE
-      run_command_bg ssh $WORKER_USERNAME@$MACHINE "WORKER_LOGGING_LEVEL=$WORKER_LOGGING_LEVEL $WORKER_LOCATION/worker.pl $WORKERURL $MACHINE $WORKER_LOG_DIR"
+      (
+        run_command ssh $WORKER_USERNAME@$MACHINE "mkdir -p $WORKER_LOCATION && mkdir -p $WORKER_LOG_DIR" ;
+        run_command scp $WORKER $WORKER_USERNAME@$MACHINE:$WORKER_LOCATION ;
+        run_command ssh $WORKER_USERNAME@$MACHINE "WORKER_LOGGING_LEVEL=$WORKER_LOGGING_LEVEL nohup $WORKER_LOCATION/worker.pl $WORKERURL $MACHINE $WORKER_LOG_DIR &> /dev/null &"
+      ) &
+      waitpids="$waitpids $!"
    done
+   wait $waitpids
    return 0
 }
 
@@ -176,7 +184,8 @@
 echo Local port: $LOCAL_PORT
 
 # Generate sites.xml
-export EXECUTIONURL="http://$IPADDR:$SERVICE_PORT"
+export SERVICEURL="http://$IPADDR:$SERVICE_PORT"
+export EXECUTIONURL="$SERVICEURL"
 export WORKERURL="http://$IPADDR:$LOCAL_PORT"
 
 echo Generating sites.xml




More information about the Swift-commit mailing list