airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [10/50] [abbrv] airavata git commit: Fixed jobId null issue
Date Tue, 12 Jan 2016 22:04:21 GMT
Fixed jobId null issue


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/4409f996
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/4409f996
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/4409f996

Branch: refs/heads/data-manager
Commit: 4409f99681d2a8bfd5ec71d8c48f2fb4d9f6856c
Parents: 7523c1e
Author: Shameera Rathnayaka <shameerainfo@gmail.com>
Authored: Mon Jan 4 16:00:35 2016 -0500
Committer: Shameera Rathnayaka <shameerainfo@gmail.com>
Committed: Mon Jan 4 16:00:35 2016 -0500

----------------------------------------------------------------------
 .../gfac/impl/task/DefaultJobSubmissionTask.java     | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/4409f996/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
index 7629f67..68d3bac 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
@@ -46,7 +46,8 @@ import java.io.IOException;
 import java.util.Map;
 
 public class DefaultJobSubmissionTask implements JobSubmissionTask {
-    private static final Logger log = LoggerFactory.getLogger(DefaultJobSubmissionTask.class);
+	private static final Logger log = LoggerFactory.getLogger(DefaultJobSubmissionTask.class);
+	public static final String DEFAULT_JOB_ID = "DEFAULT_JOB_ID";
 	private static int waitForProcessIdmillis = 5000;
 	private static int pauseTimeInSec = waitForProcessIdmillis / 1000;
 
@@ -80,8 +81,10 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
 				jobModel.setExitCode(exitCode);
 				jobModel.setStdErr(jobSubmissionOutput.getStdErr());
 				jobModel.setStdOut(jobSubmissionOutput.getStdOut());
-				GFacUtils.saveJobModel(processContext, jobModel);
-				if (exitCode != 0) {
+				String jobId = jobSubmissionOutput.getJobId();
+				if (exitCode != 0 && jobId == null) {
+					jobModel.setJobId(DEFAULT_JOB_ID);
+					GFacUtils.saveJobModel(processContext, jobModel);
 					String msg;
 					if (exitCode != Integer.MIN_VALUE) {
 						msg = "expId:" + processContext.getProcessModel().getExperimentId() + ", processId:"
+
@@ -98,7 +101,6 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
 					ErrorModel errorModel = new ErrorModel();
 					errorModel.setUserFriendlyMessage(msg);
 					errorModel.setActualErrorMessage(msg);
-					GFacUtils.saveJobModel(processContext, jobModel);
 					GFacUtils.saveExperimentError(processContext, errorModel);
 					GFacUtils.saveProcessError(processContext, errorModel);
 					GFacUtils.saveTaskError(taskContext, errorModel);
@@ -113,7 +115,6 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
 					}
 					return taskStatus;
 				}
-			    String jobId = jobSubmissionOutput.getJobId();
 			    if (jobId != null && !jobId.isEmpty()) {
 				    jobModel.setJobId(jobId);
 				    GFacUtils.saveJobModel(processContext, jobModel);
@@ -158,7 +159,9 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
 			    }
 
 			    if (jobId == null || jobId.isEmpty()) {
-				    String msg = "expId:" + processContext.getProcessModel().getExperimentId() + " Couldn't
find " +
+					jobModel.setJobId(DEFAULT_JOB_ID);
+					GFacUtils.saveJobModel(processContext, jobModel);
+					String msg = "expId:" + processContext.getProcessModel().getExperimentId() + " Couldn't
find " +
 						    "remote jobId for JobName:" + jobModel.getJobName() + ", both submit and verify
steps " +
 						    "doesn't return a valid JobId. " + "Hence changing experiment state to Failed";
 				    log.error(msg);


Mime
View raw message