airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramin...@apache.org
Subject git commit: Added error detail registration. AIRAVATA-1043
Date Tue, 04 Mar 2014 21:35:57 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 5b62ef6ac -> 592f10276


Added error detail registration. AIRAVATA-1043

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

Branch: refs/heads/master
Commit: 592f102762173e22c3a81f781d3c55e620058c28
Parents: 5b62ef6
Author: raminder <raminder@apache.org>
Authored: Tue Mar 4 16:35:42 2014 -0500
Committer: raminder <raminder@apache.org>
Committed: Tue Mar 4 16:35:42 2014 -0500

----------------------------------------------------------------------
 .../gfac/handler/GramDirectorySetupHandler.java |  7 ++++--
 .../gfac/handler/GridFTPInputHandler.java       |  5 ++++-
 .../gfac/handler/GridFTPOutputHandler.java      |  5 ++++-
 .../gfac/handler/SCPDirectorySetupHandler.java  |  9 +++++++-
 .../airavata/gfac/handler/SCPInputHandler.java  |  7 +++++-
 .../airavata/gfac/handler/SCPOutputHandler.java |  3 +++
 .../gfac/provider/impl/GSISSHProvider.java      | 18 +++++++++++----
 .../gfac/provider/impl/GramProvider.java        | 23 +++++++++++++++-----
 .../apache/airavata/gfac/utils/GFacUtils.java   | 16 ++++++++++++++
 .../gfac/utils/GramJobSubmissionListener.java   |  3 ++-
 10 files changed, 79 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/592f1027/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java
index 1964ddd..2088fe2 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java
@@ -31,7 +31,9 @@ import org.apache.airavata.gfac.context.security.GSISecurityContext;
 import org.apache.airavata.gfac.external.GridFtp;
 import org.apache.airavata.gfac.utils.GFacUtils;
 import org.apache.airavata.gfac.utils.GramJobSubmissionListener;
+import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
 import org.apache.airavata.model.workspace.experiment.DataTransferDetails;
+import org.apache.airavata.model.workspace.experiment.ErrorCategory;
 import org.apache.airavata.model.workspace.experiment.TransferState;
 import org.apache.airavata.model.workspace.experiment.TransferStatus;
 import org.apache.airavata.registry.cpi.ChildDataType;
@@ -112,11 +114,12 @@ public class GramDirectorySetupHandler extends  AbstractHandler {
                     pe = new GFacHandlerException("URI is malformatted:" + e.getMessage(),
e);
 
                 } catch (Exception e) {
-                    pe = new GFacHandlerException(e.getMessage(), e);
+              	pe = new GFacHandlerException(e.getMessage(), e);
                 }
             }
             if (success == false) {
-                throw pe;
+            	GFacUtils.saveErrorDetails(pe.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.FILE_SYSTEM_FAILURE,  jobExecutionContext.getTaskData().getTaskID());
+        		throw pe;
             }
         } catch (SecurityException e) {
             throw new GFacHandlerException(e.getMessage(), e);

http://git-wip-us.apache.org/repos/asf/airavata/blob/592f1027/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
index 29d5609..67562ec 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
@@ -42,7 +42,9 @@ import org.apache.airavata.gfac.context.MessageContext;
 import org.apache.airavata.gfac.context.security.GSISecurityContext;
 import org.apache.airavata.gfac.external.GridFtp;
 import org.apache.airavata.gfac.utils.GFacUtils;
+import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
 import org.apache.airavata.model.workspace.experiment.DataTransferDetails;
+import org.apache.airavata.model.workspace.experiment.ErrorCategory;
 import org.apache.airavata.model.workspace.experiment.TransferState;
 import org.apache.airavata.model.workspace.experiment.TransferStatus;
 import org.apache.airavata.registry.cpi.ChildDataType;
@@ -97,7 +99,8 @@ public class GridFTPInputHandler extends AbstractHandler {
          	    status.setTransferState(TransferState.FAILED);
  				detail.setTransferStatus(status);
  				registry.add(ChildDataType.DATA_TRANSFER_DETAIL,detail, jobExecutionContext.getTaskData().getTaskID());
-  			} catch (Exception e1) {
+ 				GFacUtils.saveErrorDetails(e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.FILE_SYSTEM_FAILURE,  jobExecutionContext.getTaskData().getTaskID());
+ 			} catch (Exception e1) {
   			    throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage());
   		   }
             log.error(e.getMessage());

http://git-wip-us.apache.org/repos/asf/airavata/blob/592f1027/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
index dee76a3..606d613 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
@@ -48,7 +48,9 @@ import org.apache.airavata.gfac.external.GridFtp;
 import org.apache.airavata.gfac.provider.GFacProviderException;
 import org.apache.airavata.gfac.utils.GFacUtils;
 import org.apache.airavata.gfac.utils.OutputUtils;
+import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
 import org.apache.airavata.model.workspace.experiment.DataTransferDetails;
+import org.apache.airavata.model.workspace.experiment.ErrorCategory;
 import org.apache.airavata.model.workspace.experiment.TaskDetails;
 import org.apache.airavata.model.workspace.experiment.TransferState;
 import org.apache.airavata.model.workspace.experiment.TransferStatus;
@@ -220,7 +222,8 @@ public class GridFTPOutputHandler extends AbstractHandler {
         	    status.setTransferState(TransferState.FAILED);
 				detail.setTransferStatus(status);
 				registry.add(ChildDataType.DATA_TRANSFER_DETAIL,detail, jobExecutionContext.getTaskData().getTaskID());
- 			} catch (Exception e1) {
+				GFacUtils.saveErrorDetails(e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.FILE_SYSTEM_FAILURE,  jobExecutionContext.getTaskData().getTaskID());
+	 		} catch (Exception e1) {
  			    throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage());
  		   }
         	log.error(e.getMessage());

http://git-wip-us.apache.org/repos/asf/airavata/blob/592f1027/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPDirectorySetupHandler.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPDirectorySetupHandler.java
index 121d2b7..a4dc2ea 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPDirectorySetupHandler.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPDirectorySetupHandler.java
@@ -20,15 +20,20 @@
 */
 package org.apache.airavata.gfac.handler;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.context.JobExecutionContext;
 import org.apache.airavata.gfac.context.security.GSISecurityContext;
 import org.apache.airavata.gfac.context.security.SSHSecurityContext;
+import org.apache.airavata.gfac.utils.GFacUtils;
 import org.apache.airavata.gsi.ssh.api.Cluster;
 import org.apache.airavata.gsi.ssh.api.SSHApiException;
+import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
 import org.apache.airavata.model.workspace.experiment.DataTransferDetails;
+import org.apache.airavata.model.workspace.experiment.ErrorCategory;
 import org.apache.airavata.model.workspace.experiment.TransferState;
 import org.apache.airavata.model.workspace.experiment.TransferStatus;
 import org.apache.airavata.registry.cpi.ChildDataType;
@@ -38,6 +43,7 @@ import org.slf4j.LoggerFactory;
 
 public class SCPDirectorySetupHandler extends AbstractHandler{
     private static final Logger log = LoggerFactory.getLogger(SCPDirectorySetupHandler.class);
+    private List<String> errors = new ArrayList<String>();
 
 	public void invoke(JobExecutionContext jobExecutionContext) throws GFacException {
 		log.info("Setup SSH job directorties");
@@ -80,7 +86,8 @@ public class SCPDirectorySetupHandler extends AbstractHandler{
             detail.setTransferStatus(status);
             try {
 				registry.add(ChildDataType.DATA_TRANSFER_DETAIL,detail, jobExecutionContext.getTaskData().getTaskID());
-			} catch (Exception e1) {
+				GFacUtils.saveErrorDetails(e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.FILE_SYSTEM_FAILURE,  jobExecutionContext.getTaskData().getTaskID());
+	        } catch (Exception e1) {
 			    throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage());
 		   }
             throw new GFacHandlerException("Error executing the Handler: " + SCPDirectorySetupHandler.class,e);


http://git-wip-us.apache.org/repos/asf/airavata/blob/592f1027/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
index 9d7167d..4bf352b 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
@@ -36,9 +36,13 @@ import org.apache.airavata.gfac.context.JobExecutionContext;
 import org.apache.airavata.gfac.context.MessageContext;
 import org.apache.airavata.gfac.context.security.GSISecurityContext;
 import org.apache.airavata.gfac.context.security.SSHSecurityContext;
+import org.apache.airavata.gfac.utils.GFacUtils;
 import org.apache.airavata.gsi.ssh.api.Cluster;
 import org.apache.airavata.gsi.ssh.api.SSHApiException;
+import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
 import org.apache.airavata.model.workspace.experiment.DataTransferDetails;
+import org.apache.airavata.model.workspace.experiment.ErrorCategory;
+import org.apache.airavata.model.workspace.experiment.ErrorDetails;
 import org.apache.airavata.model.workspace.experiment.TransferState;
 import org.apache.airavata.model.workspace.experiment.TransferStatus;
 import org.apache.airavata.registry.cpi.ChildDataType;
@@ -91,7 +95,8 @@ public class SCPInputHandler extends AbstractHandler {
             status.setTransferState(TransferState.FAILED);
             detail.setTransferStatus(status);
             try {
-				registry.add(ChildDataType.DATA_TRANSFER_DETAIL,detail, jobExecutionContext.getTaskData().getTaskID());
+    			GFacUtils.saveErrorDetails(e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.FILE_SYSTEM_FAILURE,  jobExecutionContext.getTaskData().getTaskID());
+    			registry.add(ChildDataType.DATA_TRANSFER_DETAIL,detail, jobExecutionContext.getTaskData().getTaskID());
 			} catch (Exception e1) {
 			    throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage());
 		   }

http://git-wip-us.apache.org/repos/asf/airavata/blob/592f1027/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
index 555a889..0e1fb3f 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
@@ -37,7 +37,9 @@ import org.apache.airavata.gfac.provider.GFacProviderException;
 import org.apache.airavata.gfac.utils.GFacUtils;
 import org.apache.airavata.gfac.utils.OutputUtils;
 import org.apache.airavata.gsi.ssh.api.Cluster;
+import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
 import org.apache.airavata.model.workspace.experiment.DataTransferDetails;
+import org.apache.airavata.model.workspace.experiment.ErrorCategory;
 import org.apache.airavata.model.workspace.experiment.TransferState;
 import org.apache.airavata.model.workspace.experiment.TransferStatus;
 import org.apache.airavata.persistance.registry.jpa.model.DataTransferDetail;
@@ -119,6 +121,7 @@ public class SCPOutputHandler extends AbstractHandler{
          	    status.setTransferState(TransferState.FAILED);
  				detail.setTransferStatus(status);
  				registry.add(ChildDataType.DATA_TRANSFER_DETAIL,detail, jobExecutionContext.getTaskData().getTaskID());
+ 				GFacUtils.saveErrorDetails(e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.FILE_SYSTEM_FAILURE,  jobExecutionContext.getTaskData().getTaskID());
   			} catch (Exception e1) {
   			    throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage());
   		   }

http://git-wip-us.apache.org/repos/asf/airavata/blob/592f1027/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
index b7bba72..8d3fcbf 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
@@ -43,6 +43,8 @@ import org.apache.airavata.gsi.ssh.api.SSHApiException;
 import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
 import org.apache.airavata.gsi.ssh.impl.PBSCluster;
 import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
+import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
+import org.apache.airavata.model.workspace.experiment.ErrorCategory;
 import org.apache.airavata.model.workspace.experiment.JobDetails;
 import org.apache.airavata.model.workspace.experiment.JobState;
 import org.apache.airavata.model.workspace.experiment.TaskDetails;
@@ -72,6 +74,8 @@ public class GSISSHProvider extends AbstractProvider implements GFacProvider{
                 getHostDescription().getType();
         HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) jobExecutionContext.getApplicationContext().
                 getApplicationDeploymentDescription().getType();
+        JobDetails jobDetails = new JobDetails();
+     	String taskID = jobExecutionContext.getTaskData().getTaskID();
         try {
             Cluster cluster = null;
             if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)
!= null) {
@@ -153,18 +157,24 @@ public class GSISSHProvider extends AbstractProvider implements GFacProvider{
             jobDescriptor.setInputValues(inputValues);
 
             log.info(jobDescriptor.toXML());
+            
+            jobDetails.setJobDescription(jobDescriptor.toXML());
+            
             String jobID = cluster.submitBatchJob(jobDescriptor);
-            JobDetails jobDetails = new JobDetails();
             jobDetails.setJobID(jobID);
             jobExecutionContext.setJobDetails(jobDetails);
-            GFacUtils.saveJobStatus(jobDetails,JobState.QUEUED,jobExecutionContext.getTaskData().getTaskID());
+            GFacUtils.saveJobStatus(jobDetails,JobState.QUEUED,taskID);
         } catch (SSHApiException e) {
             String error = "Error submitting the job to host " + host.getHostAddress() +
e.getMessage();
             log.error(error);
+        	GFacUtils.saveJobStatus(jobDetails,JobState.FAILED,taskID);
+         	GFacUtils.saveErrorDetails(error, CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR,
taskID);
             throw new GFacProviderException(error, e);
         } catch (Exception e) {
-            String error = "Error submitting the job to host " + host.getHostAddress() +
e.getMessage();
-            log.error(error);
+        	String error = "Error submitting the job to host " + host.getHostAddress() + e.getMessage();
+         	log.error(error);
+        	GFacUtils.saveJobStatus(jobDetails,JobState.FAILED,taskID);
+         	GFacUtils.saveErrorDetails(error, CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR,
taskID);
             throw new GFacProviderException(error, e);
         }
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/592f1027/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GramProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GramProvider.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GramProvider.java
index bb0cf97..9498fb6 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GramProvider.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GramProvider.java
@@ -43,6 +43,8 @@ import org.apache.airavata.gfac.provider.GFacProviderException;
 import org.apache.airavata.gfac.utils.GFacUtils;
 import org.apache.airavata.gfac.utils.GramJobSubmissionListener;
 import org.apache.airavata.gfac.utils.GramProviderUtils;
+import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
+import org.apache.airavata.model.workspace.experiment.ErrorCategory;
 import org.apache.airavata.model.workspace.experiment.JobDetails;
 import org.apache.airavata.model.workspace.experiment.JobState;
 import org.apache.airavata.model.workspace.experiment.JobStatus;
@@ -178,6 +180,8 @@ public class GramProvider extends AbstractProvider implements GFacProvider{
                             JobExecutionContext jobExecutionContext,
                             GlobusHostType globusHostType) throws GFacException, GFacProviderException
{
     	boolean applicationSaved=false;
+    	String taskID = jobExecutionContext.getTaskData().getTaskID();
+			
     	if (twoPhase) {
             try {
                 /*
@@ -198,7 +202,7 @@ public class GramProvider extends AbstractProvider implements GFacProvider{
             	details.setJobID(jobID);
             	details.setJobDescription(job.getRSL());
                 jobExecutionContext.setJobDetails(details);
-                GFacUtils.saveJobStatus(details, JobState.UN_SUBMITTED, jobExecutionContext.getTaskData().getTaskID());
+                GFacUtils.saveJobStatus(details, JobState.UN_SUBMITTED, taskID);
                 
                 applicationSaved=true;
                 String jobStatusMessage = "Un-submitted JobID= " + jobID;
@@ -219,15 +223,17 @@ public class GramProvider extends AbstractProvider implements GFacProvider{
                     log.error("Error while submitting commit request - Credentials provided
are invalid. Job Id - "
                             + job.getIDAsString(), e);
                     log.info("Attempting to renew credentials and re-submit commit signal...");
-
+                	GFacUtils.saveErrorDetails(gssException.getLocalizedMessage(), CorrectiveAction.RETRY_SUBMISSION,
ErrorCategory.AIRAVATA_INTERNAL_ERROR, taskID);
                     renewCredentials(jobExecutionContext);
 
                     try {
                         job.signal(GramJob.SIGNAL_COMMIT_REQUEST);
                     } catch (GramException e1) {
-                        throw new GFacException("Error while sending commit request. Job
Id - "
+                     	GFacUtils.saveErrorDetails(gssException.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR, taskID);
+                    	throw new GFacException("Error while sending commit request. Job Id
- "
                                 + job.getIDAsString(), e1);
                     } catch (GSSException e1) {
+                     	GFacUtils.saveErrorDetails(gssException.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR, taskID);
                         throw new GFacException("Error while sending commit request. Job
Id - "
                                 + job.getIDAsString() + ". Credentials provided invalid",
e1);
                     }
@@ -239,10 +245,14 @@ public class GramProvider extends AbstractProvider implements GFacProvider{
 
             } catch (GSSException e) {
                 // Renew credentials and re-submit
+             	GFacUtils.saveErrorDetails(e.getLocalizedMessage(), CorrectiveAction.RETRY_SUBMISSION,
ErrorCategory.AIRAVATA_INTERNAL_ERROR, taskID);
+                
                 reSubmitJob(gateKeeper, jobExecutionContext, globusHostType, e);
 
             } catch (GramException e) {
-                throw new GFacException("An error occurred while submitting a job, job id
= " + job.getIDAsString(), e);
+             	GFacUtils.saveErrorDetails(e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR, taskID);
+                
+            	throw new GFacException("An error occurred while submitting a job, job id =
" + job.getIDAsString(), e);
             }
         } else {
 
@@ -258,9 +268,10 @@ public class GramProvider extends AbstractProvider implements GFacProvider{
                 renewCredentialsAttempt = false;
 
             } catch (GramException e) {
+            	GFacUtils.saveErrorDetails(e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR, taskID);
                 throw new GFacException("An error occurred while submitting a job, job id
= " + job.getIDAsString(), e);
             } catch (GSSException e) {
-
+            	GFacUtils.saveErrorDetails(e.getLocalizedMessage(), CorrectiveAction.RETRY_SUBMISSION,
ErrorCategory.AIRAVATA_INTERNAL_ERROR, taskID);
                 // Renew credentials and re-submit
                 reSubmitJob(gateKeeper, jobExecutionContext, globusHostType, e);
             }
@@ -432,7 +443,7 @@ public class GramProvider extends AbstractProvider implements GFacProvider{
         int jobStatus = listener.getCurrentStatus();
 
         if (jobStatus == GramJob.STATUS_FAILED) {
-
+            
             String errorMsg = "Job " + job.getIDAsString() + " on host " + host.getHostAddress()
+ " Job Exit Code = "
                     + listener.getError() + " Error Description = " + getGramErrorString(listener.getError());
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/592f1027/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
index ad741b6..0ea841f 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
@@ -38,7 +38,10 @@ import org.apache.airavata.commons.gfac.type.ActualParameter;
 import org.apache.airavata.gfac.Constants;
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
 import org.apache.airavata.model.workspace.experiment.DataObjectType;
+import org.apache.airavata.model.workspace.experiment.ErrorCategory;
+import org.apache.airavata.model.workspace.experiment.ErrorDetails;
 import org.apache.airavata.model.workspace.experiment.JobDetails;
 import org.apache.airavata.model.workspace.experiment.JobState;
 import org.apache.airavata.model.workspace.experiment.JobStatus;
@@ -725,6 +728,19 @@ public class GFacUtils {
 			throw new GFacException("Error persisting job status" + e.getLocalizedMessage(),e);
 		}
 	}
+    public static void saveErrorDetails(String errorMessage, CorrectiveAction action, ErrorCategory
errorCatogory, String id) throws GFacException {
+    	try {
+    	Registry registry = RegistryFactory.getDefaultRegistry();
+		ErrorDetails details = new ErrorDetails();
+    	details.setActualErrorMessage(errorMessage);
+    	details.setCorrectiveAction(action);
+    	details.setCreationTime(Calendar.getInstance().getTimeInMillis());
+    	details.setErrorCategory(errorCatogory);
+    	registry.add(ChildDataType.ERROR_DETAIL, details, id);
+    	} catch (Exception e) {
+			throw new GFacException("Error persisting job status" + e.getLocalizedMessage(),e);
+		}
+    }
     public static JobState getApplicationJobStatus(int gramStatus) {
         switch (gramStatus) {
             case GramJob.STATUS_UNSUBMITTED:

http://git-wip-us.apache.org/repos/asf/airavata/blob/592f1027/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java
index 9fc1989..c8d8de6 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java
@@ -24,6 +24,7 @@ import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.context.JobExecutionContext;
 import org.apache.airavata.gfac.context.security.GSISecurityContext;
 import org.apache.airavata.gfac.notification.events.StatusChangeEvent;
+import org.apache.airavata.model.workspace.experiment.JobState;
 import org.globus.gram.GramJob;
 import org.globus.gram.GramJobListener;
 import org.ietf.jgss.GSSCredential;
@@ -69,7 +70,7 @@ public class GramJobSubmissionListener implements GramJobListener{
 
     private void setStatus(int status, int error) {
 		try {
-			GFacUtils.saveJobStatus(context.getJobDetails(), GFacUtils.getApplicationJobStatus(status),
context.getTaskData().getTaskID());
+			GFacUtils.updateJobStatus(context.getJobDetails(), GFacUtils.getApplicationJobStatus(status));
 		} catch (GFacException e) {
 			log.error("Error persisting status" + e.getLocalizedMessage(), e);
 		}


Mime
View raw message