[Swift-commit] Cog update
swift at ci.uchicago.edu
swift at ci.uchicago.edu
Wed Jan 11 12:50:06 CST 2012
------------------------------------------------------------------------
r3344 | jmwozniak | 2012-01-11 12:49:37 -0600 (Wed, 11 Jan 2012) | 2 lines
Restore localscheduler call to validate()
------------------------------------------------------------------------
Index: modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/CobaltExecutor.java
===================================================================
--- modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/CobaltExecutor.java (revision 3343)
+++ modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/CobaltExecutor.java (working copy)
@@ -23,7 +23,6 @@
import org.globus.cog.abstraction.impl.scheduler.common.AbstractProperties;
import org.globus.cog.abstraction.impl.scheduler.common.AbstractQueuePoller;
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.interfaces.FileLocation;
import org.globus.cog.abstraction.interfaces.JobSpecification;
@@ -32,8 +31,8 @@
public class CobaltExecutor extends AbstractExecutor {
public static final Logger logger = Logger.getLogger(CobaltExecutor.class);
- private String cqsub;
- private Pattern exitcodeRegexp;
+ private final String cqsub;
+ private final Pattern exitcodeRegexp;
private static final String[] EMPTY_STRING_ARRAY = new String[0];
@@ -45,7 +44,7 @@
}
@Override
- protected void validate(Task task) throws ProcessException {
+ protected void validate(Task task) {
JobSpecification spec = (JobSpecification) task.getSpecification();
if (spec.getAttribute("alcfbgpnat") != null) {
spec.addEnvironmentVariable("ZOID_ENABLE_NAT", "true");
@@ -53,24 +52,32 @@
super.validate(task);
}
-
-
- protected Job createJob(String jobid, String stdout,
- FileLocation stdOutputLocation, String stderr,
- FileLocation stdErrorLocation, String exitcode,
- AbstractExecutor executor) {
- return new CobaltJob(jobid, stdout, stderr, getSpec().getStdOutput(), stdOutputLocation,
- getSpec().getStdError(), stdErrorLocation, exitcodeRegexp, this);
+ @Override
+ protected Job createJob(String jobid,
+ String stdout,
+ FileLocation stdOutputLocation,
+ String stderr,
+ FileLocation stdErrorLocation,
+ String exitcode,
+ AbstractExecutor executor) {
+ return new CobaltJob(jobid, stdout, stderr,
+ getSpec().getStdOutput(),
+ stdOutputLocation,
+ getSpec().getStdError(),
+ stdErrorLocation, exitcodeRegexp, this);
}
+ @Override
protected String getName() {
return "Cobalt";
}
+ @Override
protected AbstractProperties getProperties() {
return Properties.getProperties();
}
+ @Override
protected void writeScript(Writer wr, String exitcode, String stdout,
String stderr) throws IOException {
}
@@ -112,6 +119,7 @@
}
}
+ @Override
protected String[] buildCommandLine(File jobdir, File script,
String exitcode, String stdout, String stderr) throws IOException {
List<String> result = new ArrayList<String>();
@@ -157,6 +165,7 @@
return result.toArray(EMPTY_STRING_ARRAY);
}
+ @Override
protected String quote(String s) {
boolean quotes = false;
if (s.indexOf(' ') != -1) {
@@ -180,6 +189,7 @@
return sb.toString();
}
+ @Override
protected void cleanup() {
super.cleanup();
new File(getStdout()).delete();
@@ -188,6 +198,7 @@
private static AbstractQueuePoller poller;
+ @Override
protected AbstractQueuePoller getQueuePoller() {
synchronized(CobaltExecutor.class) {
if (poller == null) {
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 3343)
+++ modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/common/AbstractExecutor.java (working copy)
@@ -26,7 +26,6 @@
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;
/**
* Set log level to DEBUG to not delete generated submit script
@@ -59,11 +58,12 @@
this.task = task;
this.spec = (JobSpecification) task.getSpecification();
this.listener = listener;
+ validate(task);
}
- public void start()
- throws AuthorizationException, IOException, ProcessException {
-
+ public void start()
+ throws AuthorizationException, IOException, ProcessException {
+
File scriptdir = new File(System.getProperty("user.home")
+ File.separatorChar + ".globus" + File.separatorChar
+ "scripts");
@@ -163,9 +163,9 @@
}
protected String[] buildCommandLine(File jobdir, File script,
- String exitcode, String stdout, String stderr)
+ String exitcode, String stdout, String stderr)
throws IOException {
-
+
writeScript(new BufferedWriter(new FileWriter(script)), exitcode,
stdout, stderr);
if (logger.isDebugEnabled()) {
@@ -216,8 +216,12 @@
throw new TaskSubmissionException("Failed to cancel task", e);
}
}
-
- protected void validate(Task task) throws ProcessException {
+
+ /**
+ Overriding methods may perform miscellaneous Task
+ processing here
+ */
+ protected void validate(Task task) {
}
protected abstract AbstractProperties getProperties();
@@ -259,7 +263,7 @@
}
protected abstract void writeScript(Writer wr, String exitcode,
- String stdout, String stderr)
+ String stdout, String stderr)
throws IOException;
protected JobSpecification getSpec() {
@@ -283,39 +287,45 @@
}
}
- public void processCompleted(int exitCode) {
+ @Override
+ public void processCompleted(int exitCode) {
cleanup();
if (listener != null) {
listener.processCompleted(exitCode);
}
}
- public void processFailed(String message) {
+ @Override
+ public void processFailed(String message) {
cleanup();
if (listener != null) {
listener.processFailed(message);
}
}
- public void statusChanged(int status) {
+ @Override
+ public void statusChanged(int status) {
if (listener != null) {
listener.statusChanged(status);
}
}
- public void stderrUpdated(String stderr) {
+ @Override
+ public void stderrUpdated(String stderr) {
if (listener != null) {
listener.stderrUpdated(stderr);
}
}
- public void stdoutUpdated(String stdout) {
+ @Override
+ public void stdoutUpdated(String stdout) {
if (listener != null) {
listener.stdoutUpdated(stdout);
}
}
- public void processFailed(Exception e) {
+ @Override
+ public void processFailed(Exception e) {
cleanup();
if (listener != null) {
listener.processFailed(e);
More information about the Swift-commit
mailing list