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

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Tue Sep 7 12:20:51 CDT 2010


Author: wilde
Date: 2010-09-07 12:20:50 -0500 (Tue, 07 Sep 2010)
New Revision: 3607

Modified:
   SwiftApps/SwiftR/Swift/R/Swift.R
Log:
Cleaned up argument/option processing. Added stub for specifiying initializer R statement for remote R processes.

Modified: SwiftApps/SwiftR/Swift/R/Swift.R
===================================================================
--- SwiftApps/SwiftR/Swift/R/Swift.R	2010-09-07 16:59:21 UTC (rev 3606)
+++ SwiftApps/SwiftR/Swift/R/Swift.R	2010-09-07 17:20:50 UTC (rev 3607)
@@ -1,49 +1,47 @@
-swiftapply <- function( func, arglists, site=NULL, callsperbatch=NULL, manualmode=NULL )
+swiftapply <- function( func, arglists, site=NULL, callsperbatch=NULL, manualmode=NULL, initialize=NULL )
 {
-  # Move swiftprops into a Swift namespace
+  # Set Swift default options if not passed as keyword paramets or pre-set by user
 
-#  if(!exists("swiftprops")) {
-#    swiftprops <<-list()
-#    swiftprops$site <<- "local"
-#    swiftprops$callsperbatch <<- 1
-#  }
-
-  # Set Swift default options if not pre-set by user
-
-  if (is.null(getOption("swift.site")))
-    options(swift.site="local")
   if (is.null(getOption("swift.callsperbatch")))
     options(swift.callsperbatch=1)
   if (is.null(getOption("swift.manualmode")))
     options(swift.manualmode = FALSE)
+  if (is.null(getOption("swift.initialize")))
+    options(swift.initialize = "")
 
-#  if(is.null(site))
-#    if( is.null(swiftprops) || is.null(swiftprops$site))
-#      site <- "local"
-#    else
-#      site <- swiftprops$site
-#  if(is.null(callsperbatch))
-#    if( is.null(swiftprops) || is.null(swiftprops$callsperbatch))
-#      callsperbatch <- 1
-#    else
-#       Callsperbatch <- swiftprops$callsperbatch
-
   if(is.null(site))
     site <- getOption("swift.site")
+  if(is.null(site))
+    site<-"local"
+
   if(is.null(callsperbatch))
     callsperbatch <- getOption("swift.callsperbatch")
+  if(is.null(callsperbatch))
+    callsperbatch <- 1
+
   if(is.null(manualmode))
     manualmode <- getOption("swift.manualmode")
+  if(is.null(manualmode))
+    manualmode <- FALSE
 
-  cat("\nSwift R properties:\n")
+  if(is.null(initialize))
+    initialExpr <- getOption("swift.initialize")
+  # else leave NULL
+
+  cat("\nSwift properties:\n")
   cat("  site =",site,"\n");
-  cat("  callsperbatch =",callsperbatch,"\n")
+  cat("  callsperbatch =", callsperbatch,"\n")
+  cat("  manualmode =", manualmode,"\n")
+  cat("  initialize =", initialize,"\n")
   cat("\nCurrent dir: ",getwd(),"\n");
 
   # Execute the calls in batches
 
   rundir <- system("mktemp -d SwiftR.run.XXX",intern=TRUE)
   cat("Swift running in",rundir,"\n")
+  if(! is.null(initialize) ) {
+    cat(initialize,file=paste(rundir,"/initialize.R",sep=""))
+  }
   narglists <- length(arglists) # number of arglists to process
   batch <- 1   # Next arglist batch number to fill
   arglist <- 1 # Next arglist number to insert




More information about the Swift-commit mailing list