[Swift-commit] r4068 - SwiftApps/SwiftR/Swift/R

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Tue Feb 8 08:58:03 CST 2011


Author: tga
Date: 2011-02-08 08:58:03 -0600 (Tue, 08 Feb 2011)
New Revision: 4068

Modified:
   SwiftApps/SwiftR/Swift/R/Workers.R
Log:
Bugfix: didn't handle case where no workers started from R.


Modified: SwiftApps/SwiftR/Swift/R/Workers.R
===================================================================
--- SwiftApps/SwiftR/Swift/R/Workers.R	2011-02-07 23:31:18 UTC (rev 4067)
+++ SwiftApps/SwiftR/Swift/R/Workers.R	2011-02-08 14:58:03 UTC (rev 4068)
@@ -150,8 +150,11 @@
     # for now, we will rely on the shell script's output to inform
     #  the user if there was a problem with the workers
     out <- system(cmdString, intern=TRUE)
-    pid <- out[1]
-    workdir <- out[2]
+    if (length(out) != 2) 
+        stop(paste("Unexpected output from start-swift: '", out, "'",
+            "Launching may have failed"))
+    pid <- out[[1]]
+    workdir <- out[[2]]
     cat("Started worker manager with pid ", pid, "\n")
     
     output <- list()
@@ -232,7 +235,8 @@
 # no argument provided, the most recent server of any type
 getWorker <- function (server=NULL) {
     if (!exists(".swift.workers") 
-        || is.null(.swift.workers)) {
+        || is.null(.swift.workers
+        || length(.swift.workers) == 0)) {
         return (NULL)
     }
     if (is.null(server)) {




More information about the Swift-commit mailing list