airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject [1/2] git commit: Fixing AIRAVATA-762, adding support to SGE
Date Mon, 31 Mar 2014 21:04:23 GMT
Repository: airavata
Updated Branches:
  refs/heads/master b47a807b4 -> b57c333b2


Fixing AIRAVATA-762, adding support to SGE


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

Branch: refs/heads/master
Commit: 346a3f5c5f48816a7825ff38096534280d28b686
Parents: b47a807
Author: lahiru <lahiru@apache.org>
Authored: Mon Mar 31 17:01:35 2014 -0400
Committer: lahiru <lahiru@apache.org>
Committed: Mon Mar 31 17:01:35 2014 -0400

----------------------------------------------------------------------
 .../client/samples/CreateLaunchExperiment.java  |  49 +++++-
 .../airavata/client/tools/DocumentCreator.java  |  88 ++++++++++
 .../org/apache/airavata/gfac/cpi/GFacImpl.java  |   9 +-
 .../gsi/ssh/api/job/SGEOutputParser.java        | 163 +++++++++++++++++++
 .../apache/airavata/gsi/ssh/impl/JobStatus.java |  14 +-
 .../airavata/gsi/ssh/util/CommonUtils.java      |   4 +
 .../gsissh/src/main/resources/SGETemplate.xslt  |  79 +++++++++
 .../impl/pull/qstat/ResourceConnection.java     |  12 +-
 .../airavata/job/monitor/util/CommonUtils.java  |   8 +
 9 files changed, 417 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/346a3f5c/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index a178712..d4756a2 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
@@ -60,8 +60,8 @@ public class CreateLaunchExperiment {
             AiravataUtils.setExecutionAsClient();
             final Airavata.Client airavata = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST,
THRIFT_SERVER_PORT);
             System.out.println("API version is " + airavata.GetAPIVersion());
-            addDescriptors();
-            final String expId = createExperimentForLocalHost(airavata);
+//            addDescriptors();
+            final String expId = createExperimentForLonestar(airavata);
 //            final String expId = createExperimentForSSHHost(airavata);
 //            final String expId = createUS3ExperimentForTrestles(airavata);
 //            final String expId = createExperimentForStampede(airavata);
@@ -129,6 +129,7 @@ public class CreateLaunchExperiment {
             documentCreator.createGramDocs();
             documentCreator.createPBSDocsForOGCE();
             documentCreator.createSlurmDocs();
+            documentCreator.createSGEDocs();
         } catch (AiravataAPIInvocationException e) {
             logger.error("Unable to create airavata API", e.getMessage());
             throw new AiravataAPIInvocationException(e);
@@ -196,6 +197,8 @@ public class CreateLaunchExperiment {
             throw new TException(e);
         }
     }
+
+
     public static String createExperimentForLocalHost(Airavata.Client client) throws TException
 {
         try{
             List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
@@ -324,7 +327,49 @@ public class CreateLaunchExperiment {
             throw new TException(e);
         }
     }
+       public static String createExperimentForLonestar(Airavata.Client client) throws TException
 {
+        try{
+            List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
+            DataObjectType input = new DataObjectType();
+            input.setKey("echo_input");
+            input.setType(DataType.STRING.toString());
+            input.setValue("echo_output=Hello World");
+            exInputs.add(input);
+
+            List<DataObjectType> exOut = new ArrayList<DataObjectType>();
+            DataObjectType output = new DataObjectType();
+            output.setKey("echo_output");
+            output.setType(DataType.STRING.toString());
+            output.setValue("");
+            exOut.add(output);
 
+            Experiment simpleExperiment =
+                    ExperimentModelUtil.createSimpleExperiment("project1", "admin", "echoExperiment",
"SimpleEcho4", "SimpleEcho4", exInputs);
+            simpleExperiment.setExperimentOutputs(exOut);
+
+            ComputationalResourceScheduling scheduling =
+                    ExperimentModelUtil.createComputationResourceScheduling("lonestar.tacc.utexas.edu",
1, 1, 1, "normal", 0, 0, 1, "TG-STA110014S");
+            scheduling.setResourceHostId("lonestar-host");
+            UserConfigurationData userConfigurationData = new UserConfigurationData();
+            userConfigurationData.setAiravataAutoSchedule(false);
+            userConfigurationData.setOverrideManualScheduledParams(false);
+            userConfigurationData.setComputationalResourceScheduling(scheduling);
+            simpleExperiment.setUserConfigurationData(userConfigurationData);
+            return client.createExperiment(simpleExperiment);
+        } catch (AiravataSystemException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new AiravataSystemException(e);
+        } catch (InvalidRequestException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new InvalidRequestException(e);
+        } catch (AiravataClientException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new AiravataClientException(e);
+        }catch (TException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new TException(e);
+        }
+    }
     public static void launchExperiment (Airavata.Client client, String expId)
             throws TException{
         try {

http://git-wip-us.apache.org/repos/asf/airavata/blob/346a3f5c/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java
----------------------------------------------------------------------
diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java
b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java
index dad3e70..7027973 100644
--- a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java
+++ b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java
@@ -446,6 +446,94 @@ public class DocumentCreator {
         }
     }
 
+    public void createSGEDocs() {
+        HostDescription host = new HostDescription(GsisshHostType.type);
+        host.getType().setHostAddress("lonestar.tacc.utexas.edu");
+        host.getType().setHostName("lonestar-host");
+        ((GsisshHostType) host.getType()).setJobManager("sge");
+        ((GsisshHostType) host.getType()).setInstalledPath("/opt/sge6.2/bin/lx24-amd64/");
+        ((GsisshHostType) host.getType()).setPort(22);
+        try {
+            airavataAPI.getApplicationManager().saveHostDescription(host);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+        }
+        /*
+        * Service Description creation and saving
+        */
+        String serviceName = "SimpleEcho4";
+        ServiceDescription serv = new ServiceDescription();
+        serv.getType().setName(serviceName);
+
+        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+
+
+        InputParameterType input = InputParameterType.Factory.newInstance();
+        input.setParameterName("echo_input");
+        ParameterType parameterType = input.addNewParameterType();
+        parameterType.setType(DataType.STRING);
+        parameterType.setName("String");
+
+        OutputParameterType output = OutputParameterType.Factory.newInstance();
+        output.setParameterName("echo_output");
+        ParameterType parameterType1 = output.addNewParameterType();
+        parameterType1.setType(DataType.STRING);
+        parameterType1.setName("String");
+
+        inputList.add(input);
+        outputList.add(output);
+
+        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
+        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);
+
+        serv.getType().setInputParametersArray(inputParamList);
+        serv.getType().setOutputParametersArray(outputParamList);
+        try {
+            airavataAPI.getApplicationManager().saveServiceDescription(serv);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+        }
+
+        /*
+           Application descriptor creation and saving
+        */
+        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
+        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
+        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+        name.setStringValue("EchoLocal");
+        app.setApplicationName(name);
+        ProjectAccountType projectAccountType = app.addNewProjectAccount();
+        projectAccountType.setProjectAccountNumber("TG-STA110014S");
+
+        QueueType queueType = app.addNewQueue();
+        queueType.setQueueName("normal");
+
+        app.setCpuCount(1);
+        app.setJobType(JobTypeType.SERIAL);
+        app.setNodeCount(1);
+        app.setProcessorsPerNode(1);
+        app.setMaxWallTime(10);
+        /*
+        * Use bat file if it is compiled on Windows
+        */
+        app.setExecutableLocation("/bin/echo");
+
+        /*
+        * Default tmp location
+        */
+        String tempDir = "/home1/01437/ogce";
+
+
+        app.setScratchWorkingDirectory(tempDir);
+        app.setInstalledParentPath("/opt/sge6.2/bin/lx24-amd64/");
+
+        try {
+            airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, "lonestar-host",
appDesc);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+        }
+    }
     public AiravataAPI getAiravataAPI() {
         return airavataAPI;
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/346a3f5c/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
index 775695a..7de9d5f 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
@@ -80,6 +80,9 @@ import java.util.*;
 public class GFacImpl implements GFac {
     private static final Logger log = LoggerFactory.getLogger(GFacImpl.class);
     public static final String ERROR_SENT = "ErrorSent";
+    public static final String PBS_JOB_MANAGER = "pbs";
+    public static final String SLURM_JOB_MANAGER = "slurm";
+    public static final String SUN_GRID_ENGINE_JOB_MANAGER = "sge";
 
     private Registry registry;
 
@@ -405,10 +408,12 @@ public class GFacImpl implements GFac {
                         log.error("No Job Manager is configured, so we are picking pbs as
the default job manager");
                         jConfig = CommonUtils.getPBSJobManager(installedParentPath);
                     } else {
-                        if ("pbs".equalsIgnoreCase(jobManager)) {
+                        if (PBS_JOB_MANAGER.equalsIgnoreCase(jobManager)) {
                             jConfig = CommonUtils.getPBSJobManager(installedParentPath);
-                        } else if ("slurm".equalsIgnoreCase(jobManager)) {
+                        } else if (SLURM_JOB_MANAGER.equalsIgnoreCase(jobManager)) {
                             jConfig = CommonUtils.getSLURMJobManager(installedParentPath);
+                        } else if(SUN_GRID_ENGINE_JOB_MANAGER.equalsIgnoreCase(jobManager)){
+                            jConfig = CommonUtils.getSGEJobManager(installedParentPath);
                         }
                     }
                     pbsCluster = new PBSCluster(serverInfo, authenticationInfo, jConfig);

http://git-wip-us.apache.org/repos/asf/airavata/blob/346a3f5c/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SGEOutputParser.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SGEOutputParser.java
b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SGEOutputParser.java
new file mode 100644
index 0000000..b2c0cff
--- /dev/null
+++ b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SGEOutputParser.java
@@ -0,0 +1,163 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gsi.ssh.api.job;
+
+import org.apache.airavata.gsi.ssh.impl.JobStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class SGEOutputParser implements OutputParser{
+    private static final Logger log = LoggerFactory.getLogger(PBSOutputParser.class);
+
+    public void parse(JobDescriptor jobDescriptor, String rawOutput) {
+        log.debug(rawOutput);
+        String[] info = rawOutput.split("\n");
+        String[] line;
+        for (int i = 0; i < info.length; i++) {
+            if (info[i].contains("=")) {
+                line = info[i].split("=", 2);
+            } else {
+                line = info[i].split(":", 2);
+            }
+            if (line.length >= 2) {
+                String header = line[0].trim();
+                log.debug("Header = " + header);
+                String value = line[1].trim();
+                log.debug("value = " + value);
+
+                if (header.equals("Variable_List")) {
+                    while (info[i + 1].startsWith("\t")) {
+                        value += info[i + 1];
+                        i++;
+                    }
+                    value = value.replaceAll("\t", "");
+                    jobDescriptor.setVariableList(value);
+                } else if ("Job Id".equals(header)) {
+                    jobDescriptor.setJobID(value);
+                } else if ("Job_Name".equals(header)) {
+                    jobDescriptor.setJobName(value);
+                } else if ("Account_Name".equals(header)) {
+                    jobDescriptor.setAcountString(value);
+                } else if ("job_state".equals(header)) {
+                    jobDescriptor.setStatus(value);
+                } else if ("Job_Owner".equals(header)) {
+                    jobDescriptor.setOwner(value);
+                } else if ("resources_used.cput".equals(header)) {
+                    jobDescriptor.setUsedCPUTime(value);
+                } else if ("resources_used.mem".equals(header)) {
+                    jobDescriptor.setUsedMemory(value);
+                } else if ("resources_used.walltime".equals(header)) {
+                    jobDescriptor.setEllapsedTime(value);
+                } else if ("job_state".equals(header)) {
+                    jobDescriptor.setStatus(value);
+                } else if ("queue".equals(header))
+                    jobDescriptor.setQueueName(value);
+                else if ("ctime".equals(header)) {
+                    jobDescriptor.setCTime(value);
+                } else if ("qtime".equals(header)) {
+                    jobDescriptor.setQTime(value);
+                } else if ("mtime".equals(header)) {
+                    jobDescriptor.setMTime(value);
+                } else if ("start_time".equals(header)) {
+                    jobDescriptor.setSTime(value);
+                } else if ("comp_time".equals(header)) {
+                    jobDescriptor.setCompTime(value);
+                } else if ("exec_host".equals(header)) {
+                    jobDescriptor.setExecuteNode(value);
+                } else if ("Output_Path".equals(header)) {
+                    if (info[i + 1].contains("=") || info[i + 1].contains(":"))
+                        jobDescriptor.setStandardOutFile(value);
+                    else {
+                        jobDescriptor.setStandardOutFile(value + info[i + 1].trim());
+                        i++;
+                    }
+                } else if ("Error_Path".equals(header)) {
+                    if (info[i + 1].contains("=") || info[i + 1].contains(":"))
+                        jobDescriptor.setStandardErrorFile(value);
+                    else {
+                        String st = info[i + 1].trim();
+                        jobDescriptor.setStandardErrorFile(value + st);
+                        i++;
+                    }
+
+                } else if ("submit_args".equals(header)) {
+                    while (i + 1 < info.length) {
+                        if (info[i + 1].startsWith("\t")) {
+                            value += info[i + 1];
+                            i++;
+                        } else
+                            break;
+                    }
+                    value = value.replaceAll("\t", "");
+                    jobDescriptor.setSubmitArgs(value);
+                }
+            }
+        }
+    }
+
+    public String parse(String rawOutput) {
+        log.debug(rawOutput);
+        String[] info = rawOutput.split("\n");
+        String lastLine = info[info.length - 1];
+        return lastLine.split(" ")[2];  //In PBS stdout is going to be directly the jobID
+    }
+
+    public JobStatus parse(String jobID, String rawOutput) {
+       // not implemented to sun grid engine
+        return JobStatus.U;
+    }
+
+    public void parse(String userName, Map<String, JobStatus> statusMap, String rawOutput)
{
+        log.debug(rawOutput);
+        String[] info = rawOutput.split("\n");
+        int lastStop = 0;
+        for (String jobID : statusMap.keySet()) {
+            for(int i=lastStop;i<info.length;i++){
+               if(jobID.contains(info[i].split(" ")[0]) && !"".equals(info[i].split("
")[0])){
+                   // now starts processing this line
+                   log.info(info[i]);
+                   String correctLine = info[i];
+                   String[] columns = correctLine.split(" ");
+                   List<String> columnList = new ArrayList<String>();
+                   for (String s : columns) {
+                       if (!"".equals(s)) {
+                           columnList.add(s);
+                       }
+                   }
+                   lastStop = i+1;
+                   if ("E".equals(columnList.get(4))) {
+                       // There is another status with the same letter E other than error
status
+                       // to avoid that we make a small tweek to the job status
+                       columnList.set(4, "Er");
+                   }
+                   statusMap.put(jobID, JobStatus.valueOf(columnList.get(4)));
+                   break;
+               }
+            }
+        }
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/346a3f5c/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/JobStatus.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/JobStatus.java b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/JobStatus.java
index ba8b58b..a87a01a 100644
--- a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/JobStatus.java
+++ b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/JobStatus.java
@@ -20,6 +20,8 @@
 */
  package org.apache.airavata.gsi.ssh.impl;
 
+ import javax.print.attribute.standard.JobState;
+
  /**
   * This will contains all the PBS specific job statuses.
   * C -     Job is completed after having run/
@@ -33,7 +35,7 @@
   * S -  (Unicos only) job is suspend.
   */
  public enum JobStatus {
-     C, E, H, Q, R, T, W, S,U,F,CA,CD,CF,CG,NF,PD,PR,TO;
+     C, E, H, Q, R, T, W, S,U,F,CA,CD,CF,CG,NF,PD,PR,TO,qw,t,r,h,Er;
 
      public static JobStatus fromString(String status){
         if(status != null){
@@ -75,6 +77,16 @@
                 return JobStatus.TO;
             }else if("U".equals(status)){
                 return JobStatus.U;
+            }else if("qw".equals(status)){
+                return JobStatus.qw;
+            }else if("t".equals(status)){
+                return JobStatus.t;
+            }else if("r".equals(status)){
+                return JobStatus.r;
+            }else if("h".equals(status)){
+                return JobStatus.h;
+            }else if("Er".equals(status)){
+                return JobStatus.Er;
             }
         }
          return JobStatus.U;

http://git-wip-us.apache.org/repos/asf/airavata/blob/346a3f5c/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/util/CommonUtils.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/util/CommonUtils.java
b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/util/CommonUtils.java
index 351c460..1aca77b 100644
--- a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/util/CommonUtils.java
+++ b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/util/CommonUtils.java
@@ -62,4 +62,8 @@ public class CommonUtils {
     public static JobManagerConfiguration getSLURMJobManager(String installedPath) {
         return new SlurmJobConfiguration("SLURMTemplate.xslt", ".slurm", installedPath, new
SlurmOutputParser());
     }
+
+     public static JobManagerConfiguration getSGEJobManager(String installedPath) {
+        return new PBSJobConfiguration("SGETemplate.xslt", ".pbs", installedPath, new SGEOutputParser());
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/346a3f5c/tools/gsissh/src/main/resources/SGETemplate.xslt
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/resources/SGETemplate.xslt b/tools/gsissh/src/main/resources/SGETemplate.xslt
new file mode 100644
index 0000000..90fbf01
--- /dev/null
+++ b/tools/gsissh/src/main/resources/SGETemplate.xslt
@@ -0,0 +1,79 @@
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements. See the NOTICE file
+	distributed with this work for additional information regarding copyright ownership. The
ASF licenses this file to you under
+	the Apache License, Version 2.0 (theƏ "License"); you may not use this file except in compliance
with the License. You may
+	obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to
+	in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF
+	ANY ~ KIND, either express or implied. See the License for the specific language governing
permissions and limitations under
+	the License. -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="http://airavata.apache.org/gsi/ssh/2012/12">
+<xsl:output method="text" />
+<xsl:template match="/ns:JobDescriptor">
+#! /bin/sh
+# Grid Engine batch job script built by Apache Airavata
+#   <xsl:choose>
+    <xsl:when test="ns:shellName">
+#$ -S <xsl:value-of select="ns:shellName"/>
+    </xsl:when></xsl:choose>
+#$ -V
+    <xsl:choose>
+    <xsl:when test="ns:queueName">
+#$ -q <xsl:value-of select="ns:queueName"/>
+    </xsl:when>
+    </xsl:choose>
+    <xsl:choose>
+    <xsl:when test="ns:mailOptions">
+#$ -m <xsl:value-of select="ns:mailOptions"/>
+    </xsl:when>
+    </xsl:choose>
+    <xsl:choose>
+<xsl:when test="ns:acountString">
+#$ -A <xsl:value-of select="ns:acountString"/>
+    </xsl:when>
+    </xsl:choose>
+    <xsl:choose>
+    <xsl:when test="ns:maxWallTime">
+#$ -l h_rt=<xsl:value-of select="ns:maxWallTime"/>
+    </xsl:when>
+    </xsl:choose>
+    <xsl:choose>
+    <xsl:when test="ns:jobName">
+#$ -N <xsl:value-of select="ns:jobName"/>
+    </xsl:when>
+    </xsl:choose>
+    <xsl:choose>
+    <xsl:when test="ns:standardOutFile">
+#$ -o <xsl:value-of select="ns:standardOutFile"/>
+    </xsl:when>
+    </xsl:choose>
+    <xsl:choose>
+    <xsl:when test="ns:standardOutFile">
+#$ -e <xsl:value-of select="ns:standardErrorFile"/>
+    </xsl:when>
+    </xsl:choose>
+    <xsl:choose>
+    <xsl:when test="(ns:nodes) and (ns:processesPerNode)">
+#$ -pe <xsl:value-of select="ns:nodes"/>way 12*<xsl:value-of select="ns:processesPerNode"/>
+<xsl:text>&#xa;</xsl:text>
+    </xsl:when>
+    </xsl:choose>
+<xsl:for-each select="ns:exports/ns:name">
+<xsl:value-of select="."/>=<xsl:value-of select="./@value"/><xsl:text>&#xa;</xsl:text>
+export<xsl:text>   </xsl:text><xsl:value-of select="."/>
+<xsl:text>&#xa;</xsl:text>
+</xsl:for-each>
+<xsl:for-each select="ns:preJobCommands/ns:command">
+      <xsl:value-of select="."/><xsl:text>   </xsl:text>
+    </xsl:for-each>
+cd <xsl:text>   </xsl:text><xsl:value-of select="ns:workingDirectory"/><xsl:text>&#xa;</xsl:text>
+    <xsl:choose><xsl:when test="ns:jobSubmitterCommand">
+<xsl:value-of select="ns:jobSubmitterCommand"/><xsl:text>   </xsl:text></xsl:when></xsl:choose><xsl:value-of
select="ns:executablePath"/><xsl:text>   </xsl:text>
+<xsl:for-each select="ns:inputs/ns:input">
+      <xsl:value-of select="."/><xsl:text>   </xsl:text>
+    </xsl:for-each>
+<xsl:for-each select="ns:postJobCommands/ns:command">
+      <xsl:value-of select="."/><xsl:text>   </xsl:text>
+</xsl:for-each>
+
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/346a3f5c/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java
b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java
index 9dc1866..8da5054 100644
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java
+++ b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java
@@ -59,6 +59,8 @@ public class ResourceConnection {
                 jConfig = CommonUtils.getPBSJobManager(installedPath);
             } else if(org.apache.airavata.job.monitor.util.CommonUtils.isSlurm(monitorID.getHost()))
{
                 jConfig = CommonUtils.getSLURMJobManager(installedPath);
+            } else if(org.apache.airavata.job.monitor.util.CommonUtils.isSGE(monitorID.getHost()))
{
+                jConfig = CommonUtils.getSGEJobManager(installedPath);
             }
             //todo support br2 etc
         }
@@ -79,6 +81,8 @@ public class ResourceConnection {
                 jConfig = CommonUtils.getPBSJobManager(installedPath);
             } else if(org.apache.airavata.job.monitor.util.CommonUtils.isSlurm(hostMonitorData.getHost()))
{
                 jConfig = CommonUtils.getSLURMJobManager(installedPath);
+            }else if(org.apache.airavata.job.monitor.util.CommonUtils.isSGE(hostMonitorData.getHost()))
{
+                jConfig = CommonUtils.getSGEJobManager(installedPath);
             }
             //todo support br2 etc
         }
@@ -113,11 +117,11 @@ public class ResourceConnection {
         if(status != null){
             if("C".equals(status) || "CD".equals(status)|| "E".equals(status) || "CG".equals(status)){
                 return JobState.COMPLETE;
-            }else if("H".equals(status)){
+            }else if("H".equals(status) || "h".equals(status)){
                 return JobState.HELD;
-            }else if("Q".equals(status)){
+            }else if("Q".equals(status) || "qw".equals(status)){
                 return JobState.QUEUED;
-            }else if("R".equals(status)  || "CF".equals(status)){
+            }else if("R".equals(status)  || "CF".equals(status) || "r".equals(status)){
                 return JobState.ACTIVE;
             }else if ("T".equals(status)) {
                 return JobState.HELD;
@@ -129,7 +133,7 @@ public class ResourceConnection {
                 return JobState.CANCELED;
             }else if ("F".equals(status) || "NF".equals(status) || "TO".equals(status)) {
                 return JobState.FAILED;
-            }else if ("PR".equals(status)) {
+            }else if ("PR".equals(status) || "Er".equals(status)) {
                 return JobState.FAILED;
             }else if ("U".equals(status)){
                 return JobState.UNKNOWN;

http://git-wip-us.apache.org/repos/asf/airavata/blob/346a3f5c/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/CommonUtils.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/CommonUtils.java
b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/CommonUtils.java
index 75f0854..42d4b8e 100644
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/CommonUtils.java
+++ b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/CommonUtils.java
@@ -55,6 +55,14 @@ public class CommonUtils {
             return false;
         }
     }
+    public static boolean isSGE(HostDescription host){
+        if("sge".equals(((GsisshHostType)host.getType()).getJobManager())){
+         return true;
+        }else{
+            // default is pbs so we return true
+            return false;
+        }
+    }
     public static String getChannelID(MonitorID monitorID) {
         return monitorID.getUserName() + "-" + monitorID.getHost().getType().getHostName();
     }


Mime
View raw message