[Swift-commit] r7996 - trunk/src/org/griphyn/vdl/karajan

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Sat Jul 12 01:26:17 CDT 2014


Author: hategan
Date: 2014-07-12 01:26:17 -0500 (Sat, 12 Jul 2014)
New Revision: 7996

Modified:
   trunk/src/org/griphyn/vdl/karajan/VDSTaskTransformer.java
Log:
can't really use wrapperInvocationMode=absolute if the swift workdir is relative, so revert to relative in that case

Modified: trunk/src/org/griphyn/vdl/karajan/VDSTaskTransformer.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/VDSTaskTransformer.java	2014-07-12 06:25:32 UTC (rev 7995)
+++ trunk/src/org/griphyn/vdl/karajan/VDSTaskTransformer.java	2014-07-12 06:26:17 UTC (rev 7996)
@@ -20,6 +20,7 @@
  */
 package org.griphyn.vdl.karajan;
 
+import java.io.File;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -51,6 +52,9 @@
 
 	public static abstract class AbstractTransformer implements TaskTransformer {
 		private SwiftConfig config;
+        private boolean initialized;
+        private String workdir;
+        private boolean absolute;
 
         public AbstractTransformer(SwiftConfig config) {
 		    this.config = config;
@@ -123,21 +127,28 @@
 			JobSpecification spec = (JobSpecification) task.getSpecification();
 			String dir = spec.getDirectory();
 			SwiftContact bc = (SwiftContact) contacts[0];
-			String workdir = (String) bc.getProperty("workdir");
-            
-            if (workdir==null){
-                workdir=System.getProperty("user.dir");
-            }
+			
+			synchronized(this) {
+    			if (!initialized) {
+    			    workdir = (String) bc.getProperty("workdir");
+    			    if (workdir == null) {
+    			        workdir = ".";
+    			    }
+    			    String mode = (String) bc.getProperty(SwiftConfig.Key.WRAPPER_INVOCATION_MODE.propName);
+    			    if (mode == null) {
+    			        mode = config.getWrapperInvocationMode();
+    			    }
+    			    absolute = mode.equals("absolute") && new File(workdir).isAbsolute();
+    			}
+			}
 
 			if (dir == null || !dir.startsWith("/")) {
-				if (workdir != null) {
-					if (dir == null) {
-						spec.setDirectory(workdir);
-					}
-					else {
-						spec.setDirectory(workdir + '/' + dir);
-					}
+				if (dir == null) {
+					spec.setDirectory(workdir);
 				}
+				else {
+					spec.setDirectory(workdir + '/' + dir);
+				}
 			}
 			List<String> l =   spec.getArgumentsAsList();
 			// perhaps should check for /bin/bash in the executable, or some 
@@ -146,14 +157,8 @@
 			// undergo this substitution...
 			String executable = l.get(0);
 
-			String mode = (String) bc.getProperty(SwiftConfig.Key.WRAPPER_INVOCATION_MODE.propName);
-			if (mode == null) {
-			    mode = config.getWrapperInvocationMode();
-			}
-			if (mode.equals("absolute")
-			        && (executable.endsWith("shared/_swiftwrap")
-			        || executable.endsWith("shared/_swiftseq"))) {
-
+			
+			if (absolute && executable.endsWith("shared/_swiftwrap")) {
 			    String s  = spec.getDirectory() + "/" + executable;
 			    l.set(0, s);
 			}




More information about the Swift-commit mailing list