Repository: airavata Updated Branches: refs/heads/master bd275a9a1 -> c8a17de16
missing error savings - AIRAVATA-1672 Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/c8a17de1 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/c8a17de1 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/c8a17de1 Branch: refs/heads/master Commit: c8a17de16bfaada4dc955af0026769caa41232ee Parents: bd275a9 Author: Chathuri Wimalasena <[email protected]> Authored: Fri Apr 17 11:18:42 2015 -0400 Committer: Chathuri Wimalasena <[email protected]> Committed: Fri Apr 17 11:18:42 2015 -0400 ---------------------------------------------------------------------- .../airavata/gfac/core/cpi/BetterGfacImpl.java | 44 +++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/c8a17de1/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java index 839e25f..8f89f9a 100644 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java +++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java @@ -990,6 +990,13 @@ public class BetterGfacImpl implements GFac,Watcher { jobExecutionContext.getExperimentID(), jobExecutionContext.getGatewayID()); monitorPublisher.publish(new TaskStatusChangeRequestEvent(TaskState.FAILED, taskIdentity)); + try { + StringWriter errors = new StringWriter(); + e.printStackTrace(new PrintWriter(errors)); + GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); + } catch (GFacException e1) { + log.error(e1.getLocalizedMessage()); + } throw new GFacException(e); } }else{ @@ -1068,7 +1075,14 @@ public class BetterGfacImpl implements GFac,Watcher { monitorPublisher.publish(new GfacExperimentStateChangeRequest(new MonitorID(jobExecutionContext) , GfacExperimentState.INHANDLERSINVOKED)); } catch (Exception e) { - throw new GFacException("Error invoking ZK", e); + try { + StringWriter errors = new StringWriter(); + e.printStackTrace(new PrintWriter(errors)); + GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); + } catch (GFacException e1) { + log.error(e1.getLocalizedMessage()); + } + throw new GFacException("Error while re-invoking output handlers", e); } } @@ -1113,16 +1127,44 @@ public class BetterGfacImpl implements GFac,Watcher { GFacUtils.updatePluginState(zk, jobExecutionContext, handlerClassName.getClassName(), GfacPluginState.COMPLETED); } } catch (ClassNotFoundException e) { + try { + StringWriter errors = new StringWriter(); + e.printStackTrace(new PrintWriter(errors)); + GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); + } catch (GFacException e1) { + log.error(e1.getLocalizedMessage()); + } log.error(e.getMessage()); throw new GFacException("Cannot load handler class " + handlerClassName, e); } catch (InstantiationException e) { + try { + StringWriter errors = new StringWriter(); + e.printStackTrace(new PrintWriter(errors)); + GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); + } catch (GFacException e1) { + log.error(e1.getLocalizedMessage()); + } log.error(e.getMessage()); throw new GFacException("Cannot instantiate handler class " + handlerClassName, e); } catch (IllegalAccessException e) { + try { + StringWriter errors = new StringWriter(); + e.printStackTrace(new PrintWriter(errors)); + GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); + } catch (GFacException e1) { + log.error(e1.getLocalizedMessage()); + } log.error(e.getMessage()); throw new GFacException("Cannot instantiate handler class " + handlerClassName, e); } catch (Exception e) { // TODO: Better error reporting. + try { + StringWriter errors = new StringWriter(); + e.printStackTrace(new PrintWriter(errors)); + GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); + } catch (GFacException e1) { + log.error(e1.getLocalizedMessage()); + } throw new GFacException("Error Executing a OutFlow Handler", e); } }
