[Swift-commit] r2380 - in trunk: libexec src/org/griphyn/vdl/karajan

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Fri Dec 26 10:00:44 CST 2008


Author: benc
Date: 2008-12-26 10:00:42 -0600 (Fri, 26 Dec 2008)
New Revision: 2380

Modified:
   trunk/libexec/vdl-int.k
   trunk/libexec/wrapper.sh
   trunk/src/org/griphyn/vdl/karajan/VDSTaskTransformer.java
Log:
work around job execution systems that do not set job initial working directory as previously expected

Modified: trunk/libexec/vdl-int.k
===================================================================
--- trunk/libexec/vdl-int.k	2008-12-19 19:48:03 UTC (rev 2379)
+++ trunk/libexec/vdl-int.k	2008-12-26 16:00:42 UTC (rev 2380)
@@ -393,7 +393,7 @@
 				
 						vdl:setprogress("Submitting")
 						vdl:execute("/bin/bash",
-							list("shared/wrapper.sh", jobid,
+							list("{sharedDir}/wrapper.sh", jobid,
 								"-jobdir", jobdir,
 								"-e", vdl:executable(tr, rhost), 
 								"-out", stdout, 

Modified: trunk/libexec/wrapper.sh
===================================================================
--- trunk/libexec/wrapper.sh	2008-12-19 19:48:03 UTC (rev 2379)
+++ trunk/libexec/wrapper.sh	2008-12-26 16:00:42 UTC (rev 2380)
@@ -87,7 +87,15 @@
 }
 
 COMMANDLINE=$@
-WFDIR=$PWD
+
+# get the parent directory of the directory containing wrapper.sh, to use
+# as the run directory
+# this assumes that wrapper.sh is being executed from the top level of
+# the shared directory, and that shared directory is in the top level
+# of the workflow run directory
+WFDIR=$(dirname $(dirname $0))
+
+cd $WFDIR
 openinfo "wrapper.log"
 ID=$1
 checkEmpty "$ID" "Missing job ID"

Modified: trunk/src/org/griphyn/vdl/karajan/VDSTaskTransformer.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/VDSTaskTransformer.java	2008-12-19 19:48:03 UTC (rev 2379)
+++ trunk/src/org/griphyn/vdl/karajan/VDSTaskTransformer.java	2008-12-26 16:00:42 UTC (rev 2380)
@@ -108,9 +108,9 @@
 		private void applyJobWorkDirectory(Task task, Contact[] contacts) {
 			JobSpecification spec = (JobSpecification) task.getSpecification();
 			String dir = spec.getDirectory();
+			BoundContact bc = (BoundContact) contacts[0];
+			String workdir = (String) bc.getProperty("workdir");
 			if (dir == null || !dir.startsWith("/")) {
-				BoundContact bc = (BoundContact) contacts[0];
-				String workdir = (String) bc.getProperty("workdir");
 				if (workdir != null) {
 					if (dir == null) {
 						spec.setDirectory(workdir);
@@ -120,6 +120,13 @@
 					}
 				}
 			}
+			List l =   spec.getArgumentsAsList();
+			// perhaps should check for /bin/bash in the executable, or some other way of detecting we need to do a substitution here... or equally could assume that the second parameter always needs to undergo this substitution...
+			if(((String)l.get(0)).endsWith("shared/wrapper.sh")) {
+				String s  = workdir+"/"+l.get(0);
+				l.set(0,s);
+			}
+
 		}
 
 		protected abstract void applyTCEntry(Task task, Contact[] contacts);




More information about the Swift-commit mailing list