|
From: <ha...@us...> - 2007-05-18 09:51:18
|
Revision: 1639
http://svn.sourceforge.net/cogkit/?rev=1639&view=rev
Author: hategan
Date: 2007-05-18 02:51:16 -0700 (Fri, 18 May 2007)
Log Message:
-----------
updates; read changelog for details.
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-gt4_0_0/CHANGES.txt
trunk/current/src/cog/modules/provider-gt4_0_0/src/org/globus/cog/abstraction/impl/execution/gt4_0_0/JobSubmissionTaskHandler.java
Modified: trunk/current/src/cog/modules/provider-gt4_0_0/CHANGES.txt
===================================================================
--- trunk/current/src/cog/modules/provider-gt4_0_0/CHANGES.txt 2007-05-17 12:32:53 UTC (rev 1638)
+++ trunk/current/src/cog/modules/provider-gt4_0_0/CHANGES.txt 2007-05-18 09:51:16 UTC (rev 1639)
@@ -1,3 +1,16 @@
+(05/18/2007)
+
+*** Failure to destroy a resource causes a warning only if the
+ job is completed, but not when the submission process fails.
+ It's impossible (I can't figure out an easy way with my
+ current knowledge) to know whether the submit call has
+ succeeded in creating the resource or not.
+
+*** Don't clean up after a failure. WS-GRAM seems to do that
+ automatically
+
+*** Removed a spurious failure state change
+
(05/17/2007)
*** Fixed flow issues when canceling a job
Modified: trunk/current/src/cog/modules/provider-gt4_0_0/src/org/globus/cog/abstraction/impl/execution/gt4_0_0/JobSubmissionTaskHandler.java
===================================================================
--- trunk/current/src/cog/modules/provider-gt4_0_0/src/org/globus/cog/abstraction/impl/execution/gt4_0_0/JobSubmissionTaskHandler.java 2007-05-17 12:32:53 UTC (rev 1638)
+++ trunk/current/src/cog/modules/provider-gt4_0_0/src/org/globus/cog/abstraction/impl/execution/gt4_0_0/JobSubmissionTaskHandler.java 2007-05-18 09:51:16 UTC (rev 1639)
@@ -52,7 +52,7 @@
public class JobSubmissionTaskHandler implements DelegatedTaskHandler,
GramJobListener {
static Logger logger = Logger.getLogger(JobSubmissionTaskHandler.class);
-
+
private Task task = null;
private GramJob gramJob;
private boolean canceling;
@@ -188,13 +188,14 @@
}
}
catch (Exception e) {
- Status newStatus = new StatusImpl();
- Status oldStatus = this.task.getStatus();
- newStatus.setPrevStatusCode(oldStatus.getStatusCode());
- newStatus.setStatusCode(Status.FAILED);
- newStatus.setException(e);
- this.task.setStatus(newStatus);
- cleanup();
+ failTask(e.getMessage(), e);
+ try {
+ cleanup();
+ }
+ catch (Exception ex) {
+ logger.info("Unable to destroy remote service for task "
+ + this.task.getIdentity().toString(), ex);
+ }
throw new TaskSubmissionException("Cannot submit job: "
+ e.getMessage(), e);
}
@@ -218,7 +219,7 @@
canceling = true;
}
this.gramJob.cancel();
- //no cleanup since cancel() calls destroy()
+ // no cleanup since cancel() calls destroy()
}
catch (Exception e) {
throw new TaskSubmissionException("Cannot cancel job", e);
@@ -331,13 +332,8 @@
}
if (canceled) {
this.task.setStatus(Status.CANCELED);
- gramJob.removeListener(this);
}
else {
- Status newStatus = new StatusImpl();
- Status oldStatus = this.task.getStatus();
- newStatus.setPrevStatusCode(oldStatus.getStatusCode());
- newStatus.setStatusCode(Status.FAILED);
int errorCode = job.getError();
if (job.getFault() != null) {
failTask("#" + errorCode + " "
@@ -347,9 +343,8 @@
else {
failTask("#" + errorCode, null);
}
- this.task.setStatus(newStatus);
- cleanup();
}
+ gramJob.removeListener(this);
}
else if (state.equals(StateEnumeration.Done)) {
if (job.getExitCode() != 0) {
@@ -360,7 +355,13 @@
else {
this.task.setStatus(Status.COMPLETED);
}
- cleanup();
+ try {
+ cleanup();
+ }
+ catch (Exception e) {
+ logger.warn("Unable to destroy remote service for task "
+ + this.task.getIdentity().toString(), e);
+ }
}
else if (state.equals(StateEnumeration.Suspended)) {
this.task.setStatus(Status.SUSPENDED);
@@ -383,18 +384,14 @@
this.task.setStatus(newStatus);
}
- private void cleanup() {
+ private void cleanup() throws Exception {
this.gramJob.removeListener(this);
- logger.debug("Destroying remote service for task "
- + this.task.getIdentity().toString());
- try {
- gramJob.release();
- gramJob.destroy();
+ if (logger.isDebugEnabled()) {
+ logger.debug("Destroying remote service for task "
+ + this.task.getIdentity().toString());
}
- catch (Exception e) {
- logger.warn("Unable to destroy remote service for task "
- + this.task.getIdentity().toString(), e);
- }
+ gramJob.release();
+ gramJob.destroy();
}
private Authorization getAuthorization(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|