[Swift-commit] cog r3919

swift at ci.uchicago.edu swift at ci.uchicago.edu
Wed Jun 18 22:30:03 CDT 2014


------------------------------------------------------------------------
r3919 | hategan | 2014-06-18 22:29:00 -0500 (Wed, 18 Jun 2014) | 1 line

properly redirect stdout and stderr from ssh when running multi-jobs
------------------------------------------------------------------------
Index: modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/lsf/LSFExecutor.java
===================================================================
--- modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/lsf/LSFExecutor.java	(revision 3918)
+++ modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/lsf/LSFExecutor.java	(working copy)
@@ -208,7 +208,7 @@
         }
 		
 		if (multiple) {
-		    writeMultiJobPostamble(wr);
+		    writeMultiJobPostamble(wr, stdout, stderr);
 		} else {
 		    wr.write('\n');
 		    wr.write("/bin/echo $? >" + exitcodefile + '\n');
Index: modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/pbs/PBSExecutor.java
===================================================================
--- modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/pbs/PBSExecutor.java	(revision 3918)
+++ modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/pbs/PBSExecutor.java	(working copy)
@@ -310,7 +310,7 @@
             wr.write(" < " + quote(spec.getStdInput()));
         }
 		if (multiple) {
-		    writeMultiJobPostamble(wr);
+		    writeMultiJobPostamble(wr, stdout, stderr);
 		}
 		else {
 		    wr.write('\n');
Index: modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/common/AbstractExecutor.java
===================================================================
--- modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/common/AbstractExecutor.java	(revision 3918)
+++ modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/common/AbstractExecutor.java	(working copy)
@@ -457,8 +457,13 @@
         return sb.toString();
     }
 
-    protected void writeMultiJobPostamble(Writer wr) throws IOException {
-        wr.write("; echo \\\\\\$? > $ECF.$INDEX \" \\\" &\n");
+    protected void writeMultiJobPostamble(Writer wr, String stdout, String stderr) throws IOException {
+        wr.write("; echo \\\\\\$? > $ECF.$INDEX \" \\\" ");
+        wr.write("1>>");
+        wr.write(quote(stdout));
+        wr.write("2>>");
+        wr.write(quote(stderr));
+        wr.write(" &\n");
         wr.write("  INDEX=$((INDEX + 1))\n");
         wr.write("done\n");
         wr.write("wait\n");
Index: modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/sge/SGEExecutor.java
===================================================================
--- modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/sge/SGEExecutor.java	(revision 3918)
+++ modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/sge/SGEExecutor.java	(working copy)
@@ -8,12 +8,10 @@
 
 import java.io.BufferedReader;
 import java.io.CharArrayReader;
-import java.io.File;
 import java.io.IOException;
 import java.io.Writer;
 import java.text.DecimalFormat;
 import java.text.NumberFormat;
-import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.regex.Matcher;
@@ -27,12 +25,10 @@
 import org.globus.cog.abstraction.impl.scheduler.common.Job;
 import org.globus.cog.abstraction.impl.scheduler.common.ProcessException;
 import org.globus.cog.abstraction.impl.scheduler.common.ProcessListener;
-import org.globus.cog.abstraction.impl.scheduler.pbs.PBSExecutor;
 import org.globus.cog.abstraction.interfaces.FileLocation;
 import org.globus.cog.abstraction.interfaces.JobSpecification;
 import org.globus.cog.abstraction.interfaces.Task;
 import org.globus.gsi.gssapi.auth.AuthorizationException;
-import org.ietf.jgss.GSSException;
 
 /**
  * Java CoG interface for Sun/Oracle Grid Engine
@@ -446,7 +442,7 @@
         }
 
         if (multiple) {
-            writeMultiJobPostamble(wr);
+            writeMultiJobPostamble(wr, stdout, stderr);
         } else {
             wr.write(" &\n");
             wr.write("wait $!\n");



More information about the Swift-commit mailing list