Repository: airavata
Updated Branches:
  refs/heads/master 23924b9a6 -> 3a0d21f27


Fix AIRAVATA-1382 (stdout is returning a warning) and AIRAVATA-1372
(ArithmeticException: / by zero)

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

Branch: refs/heads/master
Commit: 3a0d21f27729704203e16767d3636508f734b69b
Parents: 23924b9
Author: raminder <[email protected]>
Authored: Wed Aug 13 17:06:38 2014 -0400
Committer: raminder <[email protected]>
Committed: Wed Aug 13 17:06:38 2014 -0400

----------------------------------------------------------------------
 .../core/impl/GFACServiceJobSubmitter.java            |  9 +++++++--
 .../airavata/gsi/ssh/impl/GSISSHAbstractCluster.java  | 14 +++++++-------
 2 files changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/3a0d21f2/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACServiceJobSubmitter.java
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACServiceJobSubmitter.java
 
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACServiceJobSubmitter.java
index 9f4eea8..1dd8dbb 100644
--- 
a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACServiceJobSubmitter.java
+++ 
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACServiceJobSubmitter.java
@@ -85,8 +85,13 @@ public class GFACServiceJobSubmitter implements 
JobSubmitter, Watcher {
             String gfacServer = 
ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NODE, "/gfac-server");
             String experimentNode = 
ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_EXPERIMENT_NODE, 
"/gfac-experiments");
             List<String> children = zk.getChildren(gfacServer, this);
-            System.out.println(children);
-            String pickedChild = children.get(new 
Random().nextInt(Integer.MAX_VALUE) % children.size());
+//            System.out.println(children);
+            String pickedChild;
+            if(children.size() == 0){
+               pickedChild = "gfac-node0";
+            }else{
+             pickedChild = children.get(new 
Random().nextInt(Integer.MAX_VALUE) % children.size());
+            }
             // here we are not using an index because the getChildren does not 
return the same order everytime
 
             String gfacNodeData = new String(zk.getData(gfacServer + 
File.separator + pickedChild, false, null));

http://git-wip-us.apache.org/repos/asf/airavata/blob/3a0d21f2/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
----------------------------------------------------------------------
diff --git 
a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
 
b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
index c0048cf..a2336d5 100644
--- 
a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
+++ 
b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
@@ -222,7 +222,7 @@ public class GSISSHAbstractCluster implements Cluster {
 
         StandardOutReader stdOutReader = new StandardOutReader();
         CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), 
stdOutReader);
-        String outputifAvailable = getOutputifAvailable(stdOutReader, "Error 
reading output of job submission");
+        String outputifAvailable = getOutputifAvailable(stdOutReader, "Error 
reading output of job submission",rawCommandInfo.getCommand());
         // this might not be the case for all teh resources, if so Cluster 
implementation can override this method
         // because here after cancelling we try to get the job description and 
return it back
         JobDescriptor jobById = this.getJobDescriptorById(jobID);
@@ -250,7 +250,7 @@ public class GSISSHAbstractCluster implements Cluster {
         //Check whether pbs submission is successful or not, if it failed 
throw and exception in submitJob method
         // with the error thrown in qsub command
         //
-        String outputifAvailable = 
getOutputifAvailable(standardOutReader,"Error reading output of job 
submission");
+        String outputifAvailable = 
getOutputifAvailable(standardOutReader,"Error reading output of job 
submission",rawCommandInfo.getCommand());
         OutputParser outputParser = jobManagerConfiguration.getParser();
         return  outputParser.parse(outputifAvailable);
     }
@@ -315,7 +315,7 @@ public class GSISSHAbstractCluster implements Cluster {
         RawCommandInfo rawCommandInfo = 
jobManagerConfiguration.getMonitorCommand(jobID);
         StandardOutReader stdOutReader = new StandardOutReader();
         CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), 
stdOutReader);
-        String result = getOutputifAvailable(stdOutReader, "Error getting job 
information from the resource !");
+        String result = getOutputifAvailable(stdOutReader, "Error getting job 
information from the resource !",rawCommandInfo.getCommand());
         JobDescriptor jobDescriptor = new JobDescriptor();
         jobManagerConfiguration.getParser().parse(jobDescriptor,result);
         return jobDescriptor;
@@ -325,7 +325,7 @@ public class GSISSHAbstractCluster implements Cluster {
         RawCommandInfo rawCommandInfo = 
jobManagerConfiguration.getMonitorCommand(jobID);
         StandardOutReader stdOutReader = new StandardOutReader();
         CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), 
stdOutReader);
-        String result = getOutputifAvailable(stdOutReader, "Error getting job 
information from the resource !");
+        String result = getOutputifAvailable(stdOutReader, "Error getting job 
information from the resource !", rawCommandInfo.getCommand());
         return jobManagerConfiguration.getParser().parse(jobID, result);
     }
 
@@ -427,7 +427,7 @@ public class GSISSHAbstractCluster implements Cluster {
         RawCommandInfo rawCommandInfo = 
jobManagerConfiguration.getUserBasedMonitorCommand(userName);
         StandardOutReader stdOutReader = new StandardOutReader();
         CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), 
stdOutReader);
-        String result = getOutputifAvailable(stdOutReader, "Error getting job 
information from the resource !");
+        String result = getOutputifAvailable(stdOutReader, "Error getting job 
information from the resource !", rawCommandInfo.getCommand());
         jobManagerConfiguration.getParser().parse(userName,jobIDs, result);
     }
 
@@ -456,12 +456,12 @@ public class GSISSHAbstractCluster implements Cluster {
      * @return
      * @throws SSHApiException
      */
-    private String getOutputifAvailable(StandardOutReader 
jobIDReaderCommandOutput, String errorMsg) throws SSHApiException {
+    private String getOutputifAvailable(StandardOutReader 
jobIDReaderCommandOutput, String errorMsg, String command) throws 
SSHApiException {
         String stdOutputString = jobIDReaderCommandOutput.getStdOutputString();
         String stdErrorString = jobIDReaderCommandOutput.getStdErrorString();
 
         if ((stdOutputString == null || "".equals(stdOutputString)) &&
-                ((stdErrorString != null) && !("".equals(stdErrorString)))) {
+                ((stdErrorString != null) && 
!(stdErrorString.contains(command)))) {
             log.error("Standard Error output : " + stdErrorString);
             throw new SSHApiException(errorMsg + stdErrorString);
         }

Reply via email to