airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramin...@apache.org
Subject [1/2] git commit: Fix AIRAVATA-1452 for error messages.
Date Wed, 24 Sep 2014 20:07:17 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 21c9a9266 -> 0df74e911


Fix AIRAVATA-1452 for error messages. 

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

Branch: refs/heads/master
Commit: 1c00c54b9b444a45d85dc50e957a0532b32e24f9
Parents: 5ea8f2c
Author: raminder <raminder@apache.org>
Authored: Wed Sep 24 15:59:32 2014 -0400
Committer: raminder <raminder@apache.org>
Committed: Wed Sep 24 15:59:32 2014 -0400

----------------------------------------------------------------------
 .../handler/GSISSHDirectorySetupHandler.java    | 29 ++++++++++-------
 .../gfac/gsissh/handler/GSISSHInputHandler.java |  5 +++
 .../gsissh/handler/GSISSHOutputHandler.java     | 34 ++++++++++----------
 .../gsissh/provider/impl/GSISSHProvider.java    |  7 ----
 .../monitor/impl/pull/qstat/HPCPullMonitor.java | 21 ++++++++----
 .../ssh/handler/AdvancedSCPInputHandler.java    | 12 +++++++
 .../ssh/handler/AdvancedSCPOutputHandler.java   | 21 +++++++++++-
 .../ssh/handler/SSHDirectorySetupHandler.java   | 14 ++++----
 .../gfac/ssh/handler/SSHInputHandler.java       |  5 +++
 .../gfac/ssh/handler/SSHOutputHandler.java      | 28 ++++++++--------
 10 files changed, 112 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/1c00c54b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
index b647153..c90074d 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
@@ -20,10 +20,10 @@
 */
 package org.apache.airavata.gfac.gsissh.handler;
 
-import org.apache.airavata.common.exception.ApplicationSettingsException;
+import java.util.Properties;
+
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.core.context.JobExecutionContext;
-import org.apache.airavata.gfac.core.handler.AbstractHandler;
 import org.apache.airavata.gfac.core.handler.AbstractRecoverableHandler;
 import org.apache.airavata.gfac.core.handler.GFacHandlerException;
 import org.apache.airavata.gfac.core.utils.GFacUtils;
@@ -31,14 +31,16 @@ import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
 import org.apache.airavata.gfac.gsissh.util.GFACGSISSHUtils;
 import org.apache.airavata.gsi.ssh.api.Cluster;
 import org.apache.airavata.gsi.ssh.api.SSHApiException;
-import org.apache.airavata.model.workspace.experiment.*;
+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;
 import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Properties;
-
 public class GSISSHDirectorySetupHandler extends AbstractRecoverableHandler {
       private static final Logger log = LoggerFactory.getLogger(GSISSHDirectorySetupHandler.class);
 
@@ -47,10 +49,12 @@ public class GSISSHDirectorySetupHandler extends AbstractRecoverableHandler
{
             if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)
== null) {
                 GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
             }
-        } catch (ApplicationSettingsException e) {
-            log.error(e.getMessage());
-            throw new GFacHandlerException("Error while creating SSHSecurityContext", e,
e.getLocalizedMessage());
-        } catch (GFacException e) {
+        } catch (Exception e) {
+        	 try {
+  				GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+  			} catch (GFacException e1) {
+  				 log.error(e1.getLocalizedMessage());
+  			}
         	throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
         }
 
@@ -62,6 +66,11 @@ public class GSISSHDirectorySetupHandler extends AbstractRecoverableHandler
{
                 try {
         Cluster cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
         if (cluster == null) {
+        	 try {
+  				GFacUtils.saveErrorDetails(jobExecutionContext, "Security context is not set properly",
CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+  			} catch (GFacException e1) {
+  				 log.error(e1.getLocalizedMessage());
+  			}
             throw new GFacHandlerException("Security context is not set properly");
         } else {
             log.info("Successfully retrieved the Security Context");
@@ -80,8 +89,6 @@ public class GSISSHDirectorySetupHandler extends AbstractRecoverableHandler
{
 
             registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
 
-        } catch (SSHApiException e) {
-            throw new GFacHandlerException("Error executing the Handler: " + GSISSHDirectorySetupHandler.class,
e);
         } catch (Exception e) {
             DataTransferDetails detail = new DataTransferDetails();
             TransferStatus status = new TransferStatus();

http://git-wip-us.apache.org/repos/asf/airavata/blob/1c00c54b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
index b976065..3d9d65c 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
@@ -85,6 +85,11 @@ public class GSISSHInputHandler extends AbstractRecoverableHandler {
                     GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
                 } catch (ApplicationSettingsException e) {
                     log.error(e.getMessage());
+                    try {
+       				GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+                    } catch (GFacException e1) {
+       				 log.error(e1.getLocalizedMessage());
+                    }  
                     throw new GFacHandlerException("Error while creating SSHSecurityContext",
e, e.getLocalizedMessage());
                 }
             }

http://git-wip-us.apache.org/repos/asf/airavata/blob/1c00c54b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
index 9f15bd7..bcf6df1 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
@@ -98,10 +98,12 @@ public class GSISSHOutputHandler extends AbstractRecoverableHandler {
 
                 GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
             }
-        } catch (ApplicationSettingsException e) {
-            log.error(e.getMessage());
-            throw new GFacHandlerException("Error while creating SSHSecurityContext", e,
e.getLocalizedMessage());
-        } catch (GFacException e) {
+        }  catch (Exception e) {
+        	 try {
+  				GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+  			} catch (GFacException e1) {
+  				 log.error(e1.getLocalizedMessage());
+  			}  
             log.error(e.getMessage());
             throw new GFacHandlerException("Error while creating SSHSecurityContext", e,
e.getLocalizedMessage());
         }
@@ -118,6 +120,8 @@ public class GSISSHOutputHandler extends AbstractRecoverableHandler {
                 cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
             }
             if (cluster == null) {
+                GFacUtils.saveErrorDetails(jobExecutionContext, "Security context is not
set properly", CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE);
+                
                 throw new GFacProviderException("Security context is not set properly");
             } else {
                 log.info("Successfully retrieved the Security Context");
@@ -155,15 +159,21 @@ public class GSISSHOutputHandler extends AbstractRecoverableHandler
{
             }
             outputDataDir = outputDataDir + File.separator + jobExecutionContext.getExperimentID()
+ "-" + jobExecutionContext.getTaskData().getTaskID();
             (new File(outputDataDir)).mkdirs();
-
-
+         	
+            String stdOutStr = "";
             if (index < oldIndex) {
                 localStdOutFile = new File(oldFiles.get(index));
                 data.append(oldFiles.get(index++)).append(",");
             } else {
+            	int i = 0;
                 localStdOutFile = new File(outputDataDir + File.separator + timeStampedExperimentID
+ "stdout");
+                while(stdOutStr.isEmpty()){
                 cluster.scpFrom(app.getStandardOutput(), localStdOutFile.getAbsolutePath());
-                Thread.sleep(1000);
+                stdOutStr = GFacUtils.readFileToString(localStdOutFile.getAbsolutePath());
+                i++;
+                if(i==3)break;
+                }
+                
                 StringBuffer temp = new StringBuffer(data.append(localStdOutFile.getAbsolutePath()).append(",").toString());
                 GFacUtils.savePluginData(jobExecutionContext, temp.insert(0, ++index), this.getClass().getName());
             }
@@ -173,12 +183,10 @@ public class GSISSHOutputHandler extends AbstractRecoverableHandler
{
             } else {
                 localStdErrFile = new File(outputDataDir + File.separator + timeStampedExperimentID
+ "stderr");
                 cluster.scpFrom(app.getStandardError(), localStdErrFile.getAbsolutePath());
-                Thread.sleep(1000);
                 StringBuffer temp = new StringBuffer(data.append(localStdErrFile.getAbsolutePath()).append(",").toString());
                 GFacUtils.savePluginData(jobExecutionContext, temp.insert(0, ++index), this.getClass().getName());
             }
 
-            String stdOutStr = GFacUtils.readFileToString(localStdOutFile.getAbsolutePath());
             String stdErrStr = GFacUtils.readFileToString(localStdErrFile.getAbsolutePath());
             status.setTransferState(TransferState.STDOUT_DOWNLOAD);
             detail.setTransferStatus(status);
@@ -270,14 +278,6 @@ public class GSISSHOutputHandler extends AbstractRecoverableHandler {
             detail.setTransferDescription(outputDataDir);
             registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
             registry.add(ChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
-        } catch (XmlException e) {
-            throw new GFacHandlerException("Cannot read output:" + e.getMessage(), e);
-        } catch (ConnectionException e) {
-            throw new GFacHandlerException(e.getMessage(), e);
-        } catch (TransportException e) {
-            throw new GFacHandlerException(e.getMessage(), e);
-        } catch (IOException e) {
-            throw new GFacHandlerException(e.getMessage(), e);
         } catch (Exception e) {
             try {
                 status.setTransferState(TransferState.FAILED);

http://git-wip-us.apache.org/repos/asf/airavata/blob/1c00c54b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
index f28307e..b4de604 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
@@ -114,13 +114,6 @@ public class GSISSHProvider extends AbstractRecoverableProvider {
             // to perform monitoring, daemon handlers can be accessed from anywhere
             delegateToMonitorHandlers(jobExecutionContext, (GsisshHostType) host, jobID);
             // we know this host is type GsiSSHHostType
-        } catch (SSHApiException e) {
-            String error = "Error submitting the job to host " + host.getHostAddress() +
" message: " + e.getMessage();
-            log.error(error);
-            jobDetails.setJobID("none");
-            GFacUtils.saveJobStatus(jobExecutionContext, jobDetails, JobState.FAILED);
-            GFacUtils.saveErrorDetails(jobExecutionContext, error, CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR);
-            throw new GFacProviderException(error, e);
         } catch (Exception e) {
             String error = "Error submitting the job to host " + host.getHostAddress() +
" message: " + e.getMessage();
             log.error(error);

http://git-wip-us.apache.org/repos/asf/airavata/blob/1c00c54b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
index 3e9992a..621596b 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
@@ -20,7 +20,17 @@
 */
 package org.apache.airavata.gfac.monitor.impl.pull.qstat;
 
-import com.google.common.eventbus.EventBus;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.LinkedBlockingQueue;
+
 import org.apache.airavata.common.utils.MonitorPublisher;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.commons.gfac.type.HostDescription;
@@ -48,11 +58,7 @@ import org.apache.zookeeper.ZooKeeper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.sql.Timestamp;
-import java.util.*;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingDeque;
-import java.util.concurrent.LinkedBlockingQueue;
+import com.google.common.eventbus.EventBus;
 
 /**
  * This monitor is based on qstat command which can be run
@@ -243,7 +249,8 @@ public class HPCPullMonitor extends PullMonitor {
                                     publisher.publish(new TaskStatusChangeRequest(new TaskIdentity(iMonitorID.getExperimentID(),
iMonitorID.getWorkflowNodeID(),
                                             iMonitorID.getTaskID()), TaskState.FAILED));
                                     logger.info(e.getLocalizedMessage(), e);
-                                }
+                                    throw new GFacException(e.getMessage(), e);
+                        	    }
                             } else {
                                 // Evey
                                 iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));

http://git-wip-us.apache.org/repos/asf/airavata/blob/1c00c54b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
index 7e3ecbb..e4c7dfd 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
@@ -41,7 +41,9 @@ import org.apache.airavata.gsi.ssh.impl.PBSCluster;
 import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPasswordAuthenticationInfo;
 import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPublicKeyFileAuthentication;
 import org.apache.airavata.gsi.ssh.util.CommonUtils;
+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;
@@ -121,6 +123,11 @@ public class AdvancedSCPInputHandler extends AbstractRecoverableHandler
{
                     GFACSSHUtils.addSecurityContext(jobExecutionContext);
                 } catch (ApplicationSettingsException e) {
                     log.error(e.getMessage());
+                    try {
+         				GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+         			} catch (GFacException e1) {
+         				 log.error(e1.getLocalizedMessage());
+         			}
                     throw new GFacHandlerException("Error while creating SSHSecurityContext",
e, e.getLocalizedMessage());
                 }
             }
@@ -222,6 +229,11 @@ public class AdvancedSCPInputHandler extends AbstractRecoverableHandler
{
 			}
         } catch (Exception e) {
             log.error(e.getMessage());
+            try {
+ 				GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+ 			} catch (GFacException e1) {
+ 				 log.error(e1.getLocalizedMessage());
+ 			}
             throw new GFacHandlerException("Error while input File Staging", e, e.getLocalizedMessage());
         }
         jobExecutionContext.setInMessageContext(inputNew);

http://git-wip-us.apache.org/repos/asf/airavata/blob/1c00c54b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
index 428a08c..7c839b2 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
@@ -27,6 +27,7 @@ import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.core.context.JobExecutionContext;
 import org.apache.airavata.gfac.core.handler.AbstractHandler;
 import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
 import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
 import org.apache.airavata.gfac.ssh.util.GFACSSHUtils;
 import org.apache.airavata.gsi.ssh.api.Cluster;
@@ -37,8 +38,10 @@ import org.apache.airavata.gsi.ssh.impl.PBSCluster;
 import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPasswordAuthenticationInfo;
 import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPublicKeyFileAuthentication;
 import org.apache.airavata.gsi.ssh.util.CommonUtils;
+import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
 import org.apache.airavata.model.workspace.experiment.DataObjectType;
 import org.apache.airavata.model.workspace.experiment.DataType;
+import org.apache.airavata.model.workspace.experiment.ErrorCategory;
 import org.apache.airavata.registry.cpi.ChildDataType;
 import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
 import org.slf4j.Logger;
@@ -102,6 +105,11 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
                     GFACSSHUtils.addSecurityContext(jobExecutionContext);
                 } catch (ApplicationSettingsException e) {
                     log.error(e.getMessage());
+                    try {
+         				GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+         			} catch (GFacException e1) {
+         				 log.error(e1.getLocalizedMessage());
+         			}
                     throw new GFacHandlerException("Error while creating SSHSecurityContext",
e, e.getLocalizedMessage());
                 }
             }
@@ -147,6 +155,7 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
                 if ("URI".equals(actualParameter.getType().getType().toString())) {
                 	String downloadFile = MappingFactory.toString(actualParameter);
                 	if(downloadFile == null || !(new File(downloadFile).isFile())){
+                        GFacUtils.saveErrorDetails(jobExecutionContext, "Empty Output returned
from the application", CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
                 		throw new GFacHandlerException("Empty Output returned from the application");
                 	}
                 	pbsCluster.scpTo(outputPath, downloadFile);
@@ -160,11 +169,21 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
              }
            registry.add(ChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
         } catch (SSHApiException e) {
+            try {
+				GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+			} catch (GFacException e1) {
+				 log.error(e1.getLocalizedMessage());
+			}
             log.error("Error transfering files to remote host : " + hostName + " with the
user: " + userName);
             log.error(e.getMessage());
             throw new GFacHandlerException(e);
         } catch (Exception e) {
-            throw new GFacHandlerException(e);
+        	 try {
+ 				GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+ 			} catch (GFacException e1) {
+ 				 log.error(e1.getLocalizedMessage());
+ 			}
+        	throw new GFacHandlerException(e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/1c00c54b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
index e017e97..ac53b11 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
@@ -22,7 +22,6 @@ package org.apache.airavata.gfac.ssh.handler;
 
 import java.util.Properties;
 
-import org.apache.airavata.common.exception.ApplicationSettingsException;
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.core.context.JobExecutionContext;
 import org.apache.airavata.gfac.core.handler.AbstractHandler;
@@ -50,12 +49,15 @@ public class SSHDirectorySetupHandler extends AbstractHandler {
             if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)
== null) {
                 GFACSSHUtils.addSecurityContext(jobExecutionContext);
             }
-        } catch (ApplicationSettingsException e) {
+        } catch (Exception e) {
             log.error(e.getMessage());
+            try {
+ 				GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+ 			} catch (GFacException e1) {
+ 				 log.error(e1.getLocalizedMessage());
+ 			}
             throw new GFacHandlerException("Error while creating SSHSecurityContext", e,
e.getLocalizedMessage());
-        } catch (GFacException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
-        }
+        } 
 
         log.info("Setup SSH job directorties");
         super.invoke(jobExecutionContext);
@@ -83,8 +85,6 @@ public class SSHDirectorySetupHandler extends AbstractHandler {
 
             registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
 
-        } catch (SSHApiException e) {
-            throw new GFacHandlerException("Error executing the Handler: " + SSHDirectorySetupHandler.class,
e);
         } catch (Exception e) {
             DataTransferDetails detail = new DataTransferDetails();
             TransferStatus status = new TransferStatus();

http://git-wip-us.apache.org/repos/asf/airavata/blob/1c00c54b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
index 2ed2a60..d551650 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
@@ -70,6 +70,11 @@ public class SSHInputHandler extends AbstractHandler {
                     GFACSSHUtils.addSecurityContext(jobExecutionContext);
                 } catch (ApplicationSettingsException e) {
                     log.error(e.getMessage());
+                    try {
+         				GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+         			} catch (GFacException e1) {
+         				 log.error(e1.getLocalizedMessage());
+         			}
                     throw new GFacHandlerException("Error while creating SSHSecurityContext",
e, e.getLocalizedMessage());
                 }
             }

http://git-wip-us.apache.org/repos/asf/airavata/blob/1c00c54b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
index e7e1f4c..71f39c8 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
@@ -94,12 +94,14 @@ public class SSHOutputHandler extends AbstractHandler {
 
                 GFACSSHUtils.addSecurityContext(jobExecutionContext);
             }
-        } catch (ApplicationSettingsException e) {
+        } catch (Exception e) {
             log.error(e.getMessage());
+            try {
+ 				GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT,
ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+ 			} catch (GFacException e1) {
+ 				 log.error(e1.getLocalizedMessage());
+ 			}
             throw new GFacHandlerException("Error while creating SSHSecurityContext", e,
e.getLocalizedMessage());
-        } catch (GFacException e1) {
-            log.error(e1.getMessage());
-            throw new GFacHandlerException("Error while creating SSHSecurityContext", e1,
e1.getLocalizedMessage());
         }
 
         super.invoke(jobExecutionContext);
@@ -137,12 +139,18 @@ public class SSHOutputHandler extends AbstractHandler {
             localStdOutFile = new File(outputDataDir + File.separator + timeStampedExperimentID
+ "stdout");
             localStdErrFile = new File(outputDataDir + File.separator + timeStampedExperimentID
+ "stderr");
 //            cluster.makeDirectory(outputDataDir);
+            int i = 0;
+            String stdOutStr = "";
+            while(stdOutStr.isEmpty()){ 		
             cluster.scpFrom(app.getStandardOutput(), localStdOutFile.getAbsolutePath());
+            stdOutStr = GFacUtils.readFileToString(localStdOutFile.getAbsolutePath());
+            i++;
+            if(i == 3) break;
+            }
             Thread.sleep(1000);
             cluster.scpFrom(app.getStandardError(), localStdErrFile.getAbsolutePath());
             Thread.sleep(1000);
 
-            String stdOutStr = GFacUtils.readFileToString(localStdOutFile.getAbsolutePath());
             String stdErrStr = GFacUtils.readFileToString(localStdErrFile.getAbsolutePath());
             status.setTransferState(TransferState.STDOUT_DOWNLOAD);
             detail.setTransferStatus(status);
@@ -218,15 +226,7 @@ public class SSHOutputHandler extends AbstractHandler {
             registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
             registry.add(ChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
             
-        } catch (XmlException e) {
-            throw new GFacHandlerException("Cannot read output:" + e.getMessage(), e);
-        } catch (ConnectionException e) {
-            throw new GFacHandlerException(e.getMessage(), e);
-        } catch (TransportException e) {
-            throw new GFacHandlerException(e.getMessage(), e);
-        } catch (IOException e) {
-            throw new GFacHandlerException(e.getMessage(), e);
-        } catch (Exception e) {
+        }catch (Exception e) {
             try {
                 status.setTransferState(TransferState.FAILED);
                 detail.setTransferStatus(status);


Mime
View raw message