airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject airavata git commit: update error model, AIRAVATA-2096
Date Mon, 12 Sep 2016 20:14:24 GMT
Repository: airavata
Updated Branches:
  refs/heads/hotfix-AIRAVATA-2096 2289aed1d -> 5dbf84cc1


update error model, AIRAVATA-2096


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

Branch: refs/heads/hotfix-AIRAVATA-2096
Commit: 5dbf84cc1a710b17b401f182ac2c4b904544d2c5
Parents: 2289aed
Author: Shameera Rathnayaka <shameerainfo@gmail.com>
Authored: Mon Sep 12 16:14:19 2016 -0400
Committer: Shameera Rathnayaka <shameerainfo@gmail.com>
Committed: Mon Sep 12 16:14:19 2016 -0400

----------------------------------------------------------------------
 .../airavata/gfac/impl/GFacEngineImpl.java       | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/5dbf84cc/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
index 1d1391c..a57252e 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
@@ -74,6 +74,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.*;
@@ -207,14 +209,17 @@ public class GFacEngineImpl implements GFacEngine {
             return processContext;
         } catch (AppCatalogException e) {
             String msg = "App catalog access exception ";
+            saveErrorModel(processContext, e, msg);
             updateProcessFailure(processContext, msg);
             throw new GFacException(msg, e);
         } catch (RegistryException e) {
             String msg = "Registry access exception";
+            saveErrorModel(processContext, e, msg);
             updateProcessFailure(processContext, msg);
             throw new GFacException(msg, e);
         } catch (AiravataException e) {
             String msg = "Remote cluster initialization error";
+            saveErrorModel(processContext, e, msg);
             updateProcessFailure(processContext, msg);
             throw new GFacException(msg, e);
         }
@@ -877,6 +882,20 @@ public class GFacEngineImpl implements GFacEngine {
         }
     }
 
+    private void saveErrorModel(ProcessContext pc, Exception e, String userFriendlyMsg){
+        StringWriter errors = new StringWriter();
+        e.printStackTrace(new PrintWriter(errors));
+        ErrorModel errorModel = new ErrorModel();
+        errorModel.setUserFriendlyMessage(userFriendlyMsg);
+        errorModel.setActualErrorMessage(errors.toString());
+        errorModel.setCreationTime(AiravataUtils.getCurrentTimestamp().getTime());
+        try {
+            GFacUtils.saveProcessError(pc, errorModel);
+        } catch (GFacException e1) {
+            log.error("Error while updating error model for process:" + pc.getProcessId());
+        }
+    }
+
     public static ResourceJobManager getResourceJobManager(ProcessContext processCtx) throws
AppCatalogException, GFacException {
         List<JobSubmissionInterface> jobSubmissionInterfaces = Factory.getDefaultAppCatalog().getComputeResource()
                 .getComputeResource(processCtx.getComputeResourceId()).getJobSubmissionInterfaces();


Mime
View raw message