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

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Wed Feb 2 10:50:13 CST 2011


Author: tga
Date: 2011-02-02 10:50:13 -0600 (Wed, 02 Feb 2011)
New Revision: 4050

Modified:
   SwiftApps/SwiftR/Swift/R/Workers.R
Log:
Allowed hosts to be provided as a list instead of just as a single string.


Modified: SwiftApps/SwiftR/Swift/R/Workers.R
===================================================================
--- SwiftApps/SwiftR/Swift/R/Workers.R	2011-02-02 16:46:44 UTC (rev 4049)
+++ SwiftApps/SwiftR/Swift/R/Workers.R	2011-02-02 16:50:13 UTC (rev 4050)
@@ -62,9 +62,14 @@
 
     if(is.null(hosts))
         hosts <- getOption("swift.hosts")
-        if (is.null(hosts))
-            hosts <- 1
     if(! is.null(hosts) )  {
+        if (length(hosts) > 1) {
+            # Concatenate list of hosts
+            hosts <- paste(hosts, collapse=" ")
+        }
+        else if (length(hosts) == 0) {
+            stop(paste("Zero length host argument:", hosts))
+        }
         cmdString <- paste(cmdString, "-h", shQuote(hosts) )
     }
     
@@ -85,6 +90,8 @@
     else {
         if(is.null(nodes))
             nodes <- getOption("swift.nodes")
+        if(is.null(nodes))
+            nodes <- 1 # Default value
         if(! is.null(nodes) )  {
             cmdString <- paste(cmdString, "-n", shQuote(nodes)) 
         }




More information about the Swift-commit mailing list