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

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Thu Jan 20 08:51:55 CST 2011


Author: tga
Date: 2011-01-20 08:51:54 -0600 (Thu, 20 Jan 2011)
New Revision: 4001

Modified:
   SwiftApps/SwiftR/Swift/R/Swift.R
   SwiftApps/SwiftR/Swift/R/Workers.R
Log:
Minor changes: documented a race condition to be fixed in the future, made sure swiftInit got the server setting from the global options.


Modified: SwiftApps/SwiftR/Swift/R/Swift.R
===================================================================
--- SwiftApps/SwiftR/Swift/R/Swift.R	2011-01-19 22:30:37 UTC (rev 4000)
+++ SwiftApps/SwiftR/Swift/R/Swift.R	2011-01-20 14:51:54 UTC (rev 4001)
@@ -127,7 +127,16 @@
 
     requestPipeName=paste(swiftServerDir,"/requestpipe",sep="")
     resultPipeName=paste(swiftServerDir,"/resultpipe",sep="")
+
+    # fifo will block irrecoverably if there is no reader on the
+    # other end of the requestPipe.  This is bad.  The swift worker
+    # script is responsible for deleting the request pipe when it
+    # shuts down, so we know if the requestPipe still exists there
+    # should still be a worker (or the worker crashed in a funny way).
     if (file.exists(requestPipeName)) {
+        #TODO: there is a race condition here if the fifo disappears in
+        # between checking for existence and opening the fifo
+
         requestPipe <- fifo(requestPipeName,open="w",blocking=TRUE)
         cat(file=requestPipe,paste(reqdir,"\n",sep=""))
         close(requestPipe)

Modified: SwiftApps/SwiftR/Swift/R/Workers.R
===================================================================
--- SwiftApps/SwiftR/Swift/R/Workers.R	2011-01-19 22:30:37 UTC (rev 4000)
+++ SwiftApps/SwiftR/Swift/R/Workers.R	2011-01-20 14:51:54 UTC (rev 4001)
@@ -38,6 +38,9 @@
     if(! is.null(cores) )  {
         cmdString <- paste(cmdString, "-c", cores)
     }
+    
+    if(is.null(server))
+        server <- getOption("swift.server")
     if(! is.null(server) )  {
         cmdString <- paste(cmdString, "-s", server) 
     }




More information about the Swift-commit mailing list