[Swift-commit] r4142 - in SwiftApps/SwiftR/Swift: . exec tests

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Thu Feb 24 17:25:51 CST 2011


Author: tga
Date: 2011-02-24 17:25:50 -0600 (Thu, 24 Feb 2011)
New Revision: 4142

Added:
   SwiftApps/SwiftR/Swift/tests/
   SwiftApps/SwiftR/Swift/tests/runtests.R
Removed:
   SwiftApps/SwiftR/Swift/tests/runtests.R
Modified:
   SwiftApps/SwiftR/Swift/exec/EvalRBatchPersistent.sh
   SwiftApps/SwiftR/Swift/exec/rserver.swift
Log:
Oops I shouldn't have deleted that.


Modified: SwiftApps/SwiftR/Swift/exec/EvalRBatchPersistent.sh
===================================================================
--- SwiftApps/SwiftR/Swift/exec/EvalRBatchPersistent.sh	2011-02-24 23:00:09 UTC (rev 4141)
+++ SwiftApps/SwiftR/Swift/exec/EvalRBatchPersistent.sh	2011-02-24 23:25:50 UTC (rev 4142)
@@ -83,6 +83,31 @@
 
 RPIDS=
 
+TIMEOUT=5
+
+function start_timeout {
+    ppid=$$
+    trap "timeout_handler" SIGHUP
+    (
+    sleep $TIMEOUT
+    kill -1 $ppid  &> /dev/null #SIGHUP 
+    ) &
+}
+
+function stop_timeout {
+    trap "" SIGHUP
+}
+
+function timeout_handler {
+    echo 'Timed out waiting to contact R process'
+    echo 'R log follows:'
+    echo '====================='
+    cat $SLOTDIR/R.log
+    exit 1
+}
+
+
+
 # Try to make slotdir.
 # If the mkdir succeeds, this is the first request to the slot,
 # so we create a new R server and send the current request to it;
@@ -99,18 +124,18 @@
   #which Rscript >> $SLOTDIR/R.log
   echo $PATH
   $RServerScript $SLOTDIR >> $SLOTDIR/R.log 2>&1 &   # launch R server
+  start_timeout
   # idletimer $SLOTDIR </dev/null >/dev/null 2>&1 & # R saves pid in R.pid for idletimer to kill it
   echo "$0: INFO: Launched $RServerScript $SLOTDIR Rscript"
 else
   # wait to make sure fifo exists
   # fromR fifo is created last, so wait for that one
-  if [ ! -p $SLOTDIR/fromR.fifo ]; then
-    sleep 5  # FIXME: try a few times, or wait longer?
-    if [ ! -p $SLOTDIR/fromR.fifo ]; then
-      echo "$0: ERROR: FIFO $SLOTDIR/fromR.fifo did not appear within 5 seconds.\n"
-      exit 1
+  start_timeout
+  while 1; do
+    if [ -p $SLOTDIR/fromR.fifo ]; then
+      break
     fi
-  fi
+  done
 fi
 
 # Ready to talk to the server: send request and read response
@@ -130,7 +155,7 @@
     touch $SLOTDIR/lastwrite
 
     echo DB: Sent request
-
+    stop_timeout # started up ok
     echo dummy stderr response 1>&2 # FIXME - testing if this is the provider staging problem (not xfering zero len stderr)
 
     res=$(cat < $SLOTDIR/fromR.fifo)

Modified: SwiftApps/SwiftR/Swift/exec/rserver.swift
===================================================================
--- SwiftApps/SwiftR/Swift/exec/rserver.swift	2011-02-24 23:00:09 UTC (rev 4141)
+++ SwiftApps/SwiftR/Swift/exec/rserver.swift	2011-02-24 23:25:50 UTC (rev 4142)
@@ -10,7 +10,7 @@
 
 app (external e, RData result, file stout, file sterr) runR (file shellscript, file RServerScript, RData rcall)
 {
-  bash "--noprofile" @shellscript @RServerScript @rcall @result stdout=@stout stderr=@sterr;
+  bash @shellscript @RServerScript @rcall @result stdout=@stout stderr=@sterr;
 }
 
 app ack (external e[])

Copied: SwiftApps/SwiftR/Swift/tests (from rev 4140, SwiftApps/SwiftR/Swift/tests)

Deleted: SwiftApps/SwiftR/Swift/tests/runtests.R
===================================================================
--- SwiftApps/SwiftR/Swift/tests/runtests.R	2011-02-24 22:49:20 UTC (rev 4140)
+++ SwiftApps/SwiftR/Swift/tests/runtests.R	2011-02-24 23:25:50 UTC (rev 4142)
@@ -1,5 +0,0 @@
-#!/usr/bin/env Rscript
-
-library(Swift)
-#TODO: take command line options to setup options
-runAllSwiftTests()

Copied: SwiftApps/SwiftR/Swift/tests/runtests.R (from rev 4140, SwiftApps/SwiftR/Swift/tests/runtests.R)
===================================================================
--- SwiftApps/SwiftR/Swift/tests/runtests.R	                        (rev 0)
+++ SwiftApps/SwiftR/Swift/tests/runtests.R	2011-02-24 23:25:50 UTC (rev 4142)
@@ -0,0 +1,5 @@
+#!/usr/bin/env Rscript
+
+library(Swift)
+#TODO: take command line options to setup options
+runAllSwiftTests()




More information about the Swift-commit mailing list