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: integrating orchestrator-core wth orchestrator service - AIRAVATA-1028
Date Tue, 25 Feb 2014 21:57:43 GMT
Repository: airavata
Updated Branches:
  refs/heads/master db954ff0c -> 2a52bd743


integrating orchestrator-core wth orchestrator service - AIRAVATA-1028


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

Branch: refs/heads/master
Commit: 7849212bcd58af6a0109f4c53a56e0dd6da3541c
Parents: b5d57f8
Author: lahiru <lahiru@apache.org>
Authored: Tue Feb 25 16:57:22 2014 -0500
Committer: lahiru <lahiru@apache.org>
Committed: Tue Feb 25 16:57:22 2014 -0500

----------------------------------------------------------------------
 modules/airavata-job-monitor/pom.xml            |  4 +-
 .../job/monitor/AiravataJobStatusUpdator.java   | 24 +++--
 .../monitor/impl/pull/qstat/QstatMonitor.java   |  5 +-
 .../airavata/job/monitor/AMQPMonitorTest.java   | 32 ++-----
 .../airavata/job/monitor/QstatMonitorTest.java  | 43 +++------
 .../apache/airavata/common/utils/Constants.java |  1 +
 .../java/org/apache/airavata/gfac/cpi/GFac.java | 10 ++-
 .../org/apache/airavata/gfac/cpi/GFacImpl.java  | 11 ++-
 .../airavata-orchestrator-service/pom.xml       | 17 +++-
 .../server/OrchestratorServerHandler.java       | 93 +++++++++++++++++++-
 .../core/impl/EmbeddedGFACJobSubmitter.java     | 11 ++-
 .../core/OrchestratorTestWithGRAM.java          |  1 -
 .../core/OrchestratorTestWithGSISSH.java        |  2 -
 .../xbaya/invoker/EmbeddedGFacInvoker.java      | 26 ++++++
 pom.xml                                         |  1 +
 tools/gsissh/src/main/java/SSHDemo.java         |  1 +
 .../apache/airavata/gsi/ssh/GSSContextX509.java |  2 -
 .../airavata/gsi/ssh/impl/PBSCluster.java       |  3 +-
 18 files changed, 195 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/modules/airavata-job-monitor/pom.xml
----------------------------------------------------------------------
diff --git a/modules/airavata-job-monitor/pom.xml b/modules/airavata-job-monitor/pom.xml
index 4476a5d..a2afb1d 100644
--- a/modules/airavata-job-monitor/pom.xml
+++ b/modules/airavata-job-monitor/pom.xml
@@ -46,7 +46,7 @@
                 </exclusion>
             </exclusions>
         </dependency>
-        <dependency>
+        <!--dependency>
             <groupId>org.bouncycastle</groupId>
             <artifactId>bcprov-jdk15on</artifactId>
             <version>1.48</version>
@@ -55,7 +55,7 @@
             <groupId>org.bouncycastle</groupId>
             <artifactId>bcpkix-jdk15on</artifactId>
             <version>1.48</version>
-        </dependency>
+        </dependency-->
         <!-- Logging -->
         <dependency>
             <groupId>org.slf4j</groupId>

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/AiravataJobStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/AiravataJobStatusUpdator.java
b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/AiravataJobStatusUpdator.java
index 8ce7f34..f7afc4d 100644
--- a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/AiravataJobStatusUpdator.java
+++ b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/AiravataJobStatusUpdator.java
@@ -64,11 +64,6 @@ public class AiravataJobStatusUpdator{
                 the registry accordingly, for now we are just printing to standard Out
                  */
         JobState state = jobStatus.getState();
-        System.out.println("Job ID: " + jobStatus.getMonitorID().getJobID());
-        System.out.println("Username: " + jobStatus.getMonitorID().getUserName());
-        System.out.println("Job Status: " + jobStatus.getState().toString());
-
-
         switch (state) {
             case COMPLETE:
                 logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + "is DONE");
@@ -76,28 +71,29 @@ public class AiravataJobStatusUpdator{
                 break;
             case UNKNOWN:
                 logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + "is UNKNOWN");
-                System.out.println("Unknown job status came, if the old job status is RUNNING
or something active, we have to make it complete");
+                logger.info("Unknown job status came, if the old job status is RUNNING or
something active, we have to make it complete");
                 //todo implement this logic
                 break;
             case QUEUED:
-                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + "is QUEUED");
-
+                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is QUEUED");
+                break;
             case SUBMITTED:
-                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + "is SUBMITTED");
+                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is SUBMITTED");
+                break;
             case ACTIVE:
-                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + "is ACTIVE");
+                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is ACTIVE");
                 break;
             case CANCELED:
-                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + "is CANCELED");
+                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is CANCELED");
                 break;
             case FAILED:
-                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + "is FAILED");
+                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is FAILED");
                 break;
             case HELD:
-                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + "is HELD");
+                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is HELD");
                 break;
             case SUSPENDED:
-                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + "is SUSPENDED");
+                logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is SUSPENDED");
                 break;
         }
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java
----------------------------------------------------------------------
diff --git a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java
b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java
index 9568691..85cc29d 100644
--- a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java
+++ b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java
@@ -134,7 +134,10 @@ public class QstatMonitor extends PullMonitor implements Runnable {
                     // in this case job is finished or may be the given job ID is wrong
                     jobStatus.setState(JobState.UNKNOWN);
                     publisher.publish(jobStatus);
-                }else if(!this.queue.contains(take)){   // we put the job back to the queue
only if its state is not unknown
+                }else if(e.getMessage().contains("illegally formed job identifier")){
+                   logger.error("Wrong job ID is given so dropping the job from monitoring
system");
+                }
+                else if(!this.queue.contains(take)){   // we put the job back to the queue
only if its state is not unknown
                     try {
                         this.queue.put(take);
                     } catch (InterruptedException e1) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/modules/airavata-job-monitor/src/test/java/org/apache/airavata/job/monitor/AMQPMonitorTest.java
----------------------------------------------------------------------
diff --git a/modules/airavata-job-monitor/src/test/java/org/apache/airavata/job/monitor/AMQPMonitorTest.java
b/modules/airavata-job-monitor/src/test/java/org/apache/airavata/job/monitor/AMQPMonitorTest.java
index 50b6c38..581c1f9 100644
--- a/modules/airavata-job-monitor/src/test/java/org/apache/airavata/job/monitor/AMQPMonitorTest.java
+++ b/modules/airavata-job-monitor/src/test/java/org/apache/airavata/job/monitor/AMQPMonitorTest.java
@@ -73,7 +73,7 @@ public class AMQPMonitorTest {
             monitorManager.addPushMonitor(amqpMonitor);
             monitorManager.launchMonitor();
         } catch (AiravataMonitorException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+            e.printStackTrace();
         }
 
         hostDescription = new HostDescription(GsisshHostType.type);
@@ -120,30 +120,16 @@ public class AMQPMonitorTest {
         //finished construction of job object
         System.out.println(jobDescriptor.toXML());
         String jobID = pbsCluster.submitBatchJob(jobDescriptor);
-
-        Thread test = new TestThread(monitorManager);
-        test.start();
+        System.out.println(jobID);
         try {
-            test.join();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-    }
-
-    private class TestThread extends Thread {
-        private MonitorManager manager;
-
-        public TestThread(MonitorManager manager) {
-            this.manager = manager;
+            monitorManager.addAJobToMonitor(new MonitorID(hostDescription, jobID, "ogce"));
+        } catch (AiravataMonitorException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
         }
-
-        @Override
-        public void run() {
-            try {
-                monitorManager.addAJobToMonitor(new MonitorID(hostDescription, "gordon.sdsc.xsede.org",
"ogce"));
-            } catch (AiravataMonitorException e) {
-                e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
-            }
+        try {
+            Thread.sleep(10000);
+        } catch (InterruptedException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/modules/airavata-job-monitor/src/test/java/org/apache/airavata/job/monitor/QstatMonitorTest.java
----------------------------------------------------------------------
diff --git a/modules/airavata-job-monitor/src/test/java/org/apache/airavata/job/monitor/QstatMonitorTest.java
b/modules/airavata-job-monitor/src/test/java/org/apache/airavata/job/monitor/QstatMonitorTest.java
index 8985ecd..e3a4873 100644
--- a/modules/airavata-job-monitor/src/test/java/org/apache/airavata/job/monitor/QstatMonitorTest.java
+++ b/modules/airavata-job-monitor/src/test/java/org/apache/airavata/job/monitor/QstatMonitorTest.java
@@ -73,7 +73,7 @@ public class QstatMonitorTest {
             monitorManager.addPullMonitor(qstatMonitor);
             monitorManager.launchMonitor();
         } catch (AiravataMonitorException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+            e.printStackTrace();
         }
 
         hostDescription = new HostDescription(GsisshHostType.type);
@@ -82,7 +82,7 @@ public class QstatMonitorTest {
     }
 
     @Test
-    public void testAMQPMonitor() throws SSHApiException {
+    public void testQstatMonitor() throws SSHApiException {
         /* now have to submit a job to some machine and add that job to the queue */
         //Create authentication
         GSIAuthenticationInfo authenticationInfo
@@ -119,41 +119,20 @@ public class QstatMonitorTest {
         jobDescriptor.setInputValues(inputs);
         //finished construction of job object
         System.out.println(jobDescriptor.toXML());
-        String jobID = pbsCluster.submitBatchJob(jobDescriptor);
-
-        Thread test = new TestThread(monitorManager,jobID);
-        test.start();
-        try {
-            Thread.sleep(1000000);
-            test.join();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-    }
-
-    private class TestThread extends Thread {
-        private MonitorManager manager;
-
-        private String jobID;
-
-        public TestThread(MonitorManager manager,String jobID) {
-            this.manager = manager;
-            this.jobID = jobID;
-        }
-
-        @Override
-        public void run() {
+        for (int i = 0; i < 50; i++) {
+            String jobID = pbsCluster.submitBatchJob(jobDescriptor);
+            MonitorID monitorID = new MonitorID(hostDescription, jobID, "ogce");
+            monitorID.setAuthenticationInfo(authenticationInfo);
             try {
-                MonitorID monitorID = new MonitorID(hostDescription, jobID, "ogce");
-                GSIAuthenticationInfo authenticationInfo
-                = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
-                7512, 17280000, certificateLocation);
-                monitorID.setAuthenticationInfo(authenticationInfo);
-
                 monitorManager.addAJobToMonitor(monitorID);
             } catch (AiravataMonitorException e) {
                 e.printStackTrace();
             }
         }
+        try {
+            Thread.sleep(10000000);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Constants.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Constants.java
b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Constants.java
index effc4bb..1101d9d 100644
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Constants.java
+++ b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Constants.java
@@ -29,4 +29,5 @@ public final class Constants {
     public static final String USER_IN_SESSION = "userName";
     public static final String GATEWAY_NAME = "gateway_id";
     public static final String GFAC_CONFIG_XML = "gfac-config.xml";
+    public static final String MONITOR_PROPERTIES = "monitor.properties";
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java
index b9ff2c4..a2a4b1e 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java
@@ -21,6 +21,7 @@
 package org.apache.airavata.gfac.cpi;
 
 import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.context.JobExecutionContext;
 import org.apache.airavata.model.experiment.ConfigurationData;
 import org.apache.airavata.registry.cpi.DataType;
 
@@ -38,6 +39,13 @@ public interface GFac {
      * @return
      * @throws org.apache.airavata.gfac.GFacException
      */
-    public boolean submitJob(String experimentID) throws GFacException;
+    public JobExecutionContext submitJob(String experimentID) throws GFacException;
+
+    /**
+     * This method has to be invoked after submitting the job and have to make sure job is
properly finished
+     * @param jobExecutionContext
+     * @throws GFacException
+     */
+    public void invokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException;
 
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/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 d73d1b0..f2befc4 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
@@ -109,10 +109,10 @@ public class GFacImpl implements GFac {
      * @return
      * @throws GFacException
      */
-    public boolean submitJob(String experimentID) throws GFacException {
+    public JobExecutionContext submitJob(String experimentID) throws GFacException {
         ConfigurationData configurationData = (ConfigurationData) registry.get(DataType.EXPERIMENT_CONFIGURATION_DATA,
experimentID);
         String serviceName = configurationData.getApplicationId();
-
+        JobExecutionContext jobExecutionContext = null;
         if (serviceName == null) {
             throw new GFacException("Error executing the job because there is not Application
Name in this Experiment");
         }
@@ -133,7 +133,7 @@ public class GFacImpl implements GFac {
             Properties configurationProperties = ServerSettings.getProperties();
             GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),
airavataAPI, configurationProperties);
 
-            JobExecutionContext jobExecutionContext = new JobExecutionContext(gFacConfiguration,
serviceName);
+            jobExecutionContext = new JobExecutionContext(gFacConfiguration, serviceName);
 
             ApplicationContext applicationContext = new ApplicationContext();
             applicationContext.setApplicationDeploymentDescription(applicationDescription);
@@ -158,7 +158,7 @@ public class GFacImpl implements GFac {
             log.error("Error inovoking the job with experiment ID: " + experimentID);
             throw new GFacException(e);
         }
-        return true;
+        return jobExecutionContext;
     }
 
     public void submitJob(JobExecutionContext jobExecutionContext) throws GFacException {
@@ -196,7 +196,6 @@ public class GFacImpl implements GFac {
                 executeProvider(provider, jobExecutionContext);
                 disposeProvider(provider, jobExecutionContext);
             }
-            invokeOutFlowHandlers(jobExecutionContext);
 //            if (experimentID != null){
 //                registry2.changeStatus(jobExecutionContext.getExperimentID(),AiravataJobState.State.OUTHANDLERSDONE);
 //            }
@@ -264,7 +263,7 @@ public class GFacImpl implements GFac {
         }
     }
 
-    private void invokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException
{
+    public void invokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException
{
         List<GFacHandlerConfig> handlers = jobExecutionContext.getGFacConfiguration().getOutHandlers();
 
         for (GFacHandlerConfig handlerClassName : handlers) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/modules/orchestrator/airavata-orchestrator-service/pom.xml
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/pom.xml b/modules/orchestrator/airavata-orchestrator-service/pom.xml
index edb37ab..24f4793 100644
--- a/modules/orchestrator/airavata-orchestrator-service/pom.xml
+++ b/modules/orchestrator/airavata-orchestrator-service/pom.xml
@@ -26,7 +26,6 @@
     <url>http://airavata.apache.org/</url>
 
     <dependencies>
-
         <dependency>
             <groupId>org.apache.thrift</groupId>
             <artifactId>libthrift</artifactId>
@@ -37,7 +36,21 @@
             <artifactId>slf4j-log4j12</artifactId>
             <version>${org.slf4j.version}</version>
         </dependency>
-
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-orchestrator-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-job-monitor</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-gfac-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
index d965ec9..de5b47d 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
@@ -21,11 +21,35 @@
 
 package org.apache.airavata.orchestrator.server;
 
+import org.apache.airavata.common.utils.Constants;
+import org.apache.airavata.job.monitor.MonitorManager;
+import org.apache.airavata.job.monitor.core.Monitor;
+import org.apache.airavata.job.monitor.core.PullMonitor;
+import org.apache.airavata.job.monitor.core.PushMonitor;
+import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
+import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
 import org.apache.airavata.orchestrator.cpi.OrchestratorService;
+import org.apache.airavata.orchestrator.cpi.impl.SimpleOrchestratorImpl;
 import org.apache.airavata.orchestrator.cpi.orchestrator_cpi_serviceConstants;
+import org.apache.airavata.persistance.registry.jpa.impl.RegistryImpl;
+import org.apache.airavata.registry.cpi.Registry;
 import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
 
 public class OrchestratorServerHandler implements OrchestratorService.Iface {
+    private static Logger log = LoggerFactory.getLogger(OrchestratorServerHandler.class);
+
+    private MonitorManager monitorManager = null;
+
+    private SimpleOrchestratorImpl orchestrator = null;
+
+    private Registry registry;
 
     /**
      * Query orchestrator server to fetch the CPI version
@@ -37,9 +61,56 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface
{
     }
 
 
-
     public OrchestratorServerHandler() {
-        System.out.println("testing the default constructor");
+        URL monitorUrl = OrchestratorServerHandler.class.getClassLoader().getResource(Constants.MONITOR_PROPERTIES);
+        Properties properties = new Properties();
+        try {
+            // first constructing the monitorManager and orchestrator, then fill the required
properties
+            monitorManager = new MonitorManager();
+            orchestrator = new SimpleOrchestratorImpl();
+            registry = new RegistryImpl();
+
+            // Filling monitorManager properties
+            properties.load(monitorUrl.openStream());
+            String primaryMonitor = properties.getProperty("primaryMonitor");
+            String secondaryMonitor = properties.getProperty("secondaryMonitor");
+            if (primaryMonitor == null) {
+                log.error("Error loading primaryMonitor and there has to be a primary monitor");
+            } else {
+                Class<? extends Monitor> aClass = Class.forName(primaryMonitor).asSubclass(Monitor.class);
+                Monitor monitor = aClass.newInstance();
+                if (monitor instanceof PullMonitor) {
+                    monitorManager.addPullMonitor((PullMonitor) monitor);
+                } else if (monitor instanceof PushMonitor) {
+                    monitorManager.addPushMonitor((PushMonitor) monitor);
+                } else {
+                    log.error("Wrong class is given to primary Monitor");
+                }
+            }
+            if (secondaryMonitor == null) {
+                log.info("No secondary Monitor has configured !!!!");
+            } else {
+                // todo we do not support a secondary Monitor at this point
+            }
+
+            // Now Monitor Manager is properly configured, now we have to start the monitoring
system.
+            // This will initialize all the required threads and required queues
+            monitorManager.launchMonitor();
+        } catch (OrchestratorException e) {
+            e.printStackTrace();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        } catch (InstantiationException e) {
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        } catch (AiravataMonitorException e) {
+            e.printStackTrace();
+        }
     }
 
     /**
@@ -58,7 +129,23 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface
{
     public boolean launchExperiment(String experimentId) throws TException {
         //TODO: Write the Orchestrator implementaion
 
-
+        /*
+        Use the registry to take the Experiment Model object
+         check the ExperimentModel object to check airavataAutoSchedule property
+         if its set give an error telling that we do not support it
+         else create a Task and save to the registry
+         This should return the task ID
+         if monitoring is in push mode, add the job to monitor queue, i hope by this time
the host has finalized
+         Get the task ID and invoke GFAC
+         GFac will submit the job and return the jobID
+         submit the job to minitor to monitoring queue after the submission if the monitoring
is in pull mode
+         RETURN;
+        */
+        try {
+            orchestrator.launchExperiment(experimentId);
+        } catch (OrchestratorException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+        }
         return false;
     }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
index c324e8b..4a101bf 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
@@ -24,6 +24,7 @@ package org.apache.airavata.orchestrator.core.impl;
 import java.util.*;
 
 import org.apache.airavata.common.utils.AiravataJobState;
+import org.apache.airavata.gfac.context.JobExecutionContext;
 import org.apache.airavata.gfac.cpi.GFac;
 import org.apache.airavata.orchestrator.core.context.OrchestratorContext;
 import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
@@ -44,6 +45,13 @@ public class EmbeddedGFACJobSubmitter implements JobSubmitter {
 
     private OrchestratorContext orchestratorContext;
 
+    private GFac gfac;
+
+    public EmbeddedGFACJobSubmitter(GFac gfac, OrchestratorContext orchestratorContext) {
+        this.gfac = gfac;
+        this.orchestratorContext = orchestratorContext;
+    }
+
     public void initialize(OrchestratorContext orchestratorContext) throws OrchestratorException
{
         this.orchestratorContext = orchestratorContext;
     }
@@ -74,8 +82,7 @@ public class EmbeddedGFACJobSubmitter implements JobSubmitter {
         Registry newRegistry = orchestratorContext.getNewRegistry();
         try {
             //todo init this during submitter init
-            GFac gFac = new GFacImpl(newRegistry, orchestratorContext.getOrchestratorConfiguration().getAiravataAPI(),
orchestratorContext.getRegistry());
-            gFac.submitJob(experimentID);
+            JobExecutionContext jobExecutionContext = gfac.submitJob(experimentID);
             orchestratorContext.getRegistry().changeStatus(experimentID, AiravataJobState.State.SUBMITTED);
         } catch (Exception e)
         {

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGRAM.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGRAM.java
b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGRAM.java
index bd1cf8a..1c62a0d 100644
--- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGRAM.java
+++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGRAM.java
@@ -85,7 +85,6 @@ public class OrchestratorTestWithGRAM extends BaseOrchestratorTest {
 
         boolean b = orchestrator.launchExperiment(experimentID);
 
-        Thread.sleep(100000);
         if (b) {
             Assert.assertTrue(true);
         } else {

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGSISSH.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGSISSH.java
b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGSISSH.java
index 38a6689..6393523 100644
--- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGSISSH.java
+++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGSISSH.java
@@ -53,8 +53,6 @@ public class OrchestratorTestWithGSISSH extends BaseOrchestratorTest {
      }
 
      private void createJobRequestWithDocuments() {
-
-
          //Using new airavata-api methods to store experiment metadata
          BasicMetadata basicMetadata = new BasicMetadata();
          basicMetadata.setExperimentName("test-trestles-gsissh");

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
index 29a32f4..c76ab14 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
@@ -407,6 +407,7 @@ public class EmbeddedGFacInvoker implements Invoker {
         if (registeredHost.getType() instanceof GlobusHostType || registeredHost.getType()
instanceof UnicoreHostType
                 || registeredHost.getType() instanceof GsisshHostType) {
 
+            /* todo fix the credential store and uncomment following code block
             SecurityContextDocument.SecurityContext.CredentialManagementService credentialManagementService
                     = getCredentialManagementService(contextHeader);
 
@@ -445,6 +446,31 @@ public class EmbeddedGFacInvoker implements Invoker {
 
                 context.setPbsCluster(pbsCluster);
             }
+            */
+            requestData = new RequestData("default");
+            GSISecurityContext context;
+            try {
+                context = new GSISecurityContext(CredentialReaderFactory.createCredentialStoreReader(),
requestData);
+            } catch (Exception e) {
+                throw new WorkflowException("An error occurred while creating GSI security
context", e);
+            }
+
+            if (registeredHost.getType() instanceof GsisshHostType) {
+                GSIAuthenticationInfo authenticationInfo
+                        = new MyProxyAuthenticationInfo(requestData.getMyProxyUserName(),
requestData.getMyProxyPassword(), requestData.getMyProxyServerUrl(),
+                        requestData.getMyProxyPort(), requestData.getMyProxyLifeTime(), System.getProperty(Constants.TRUSTED_CERTIFICATE_SYSTEM_PROPERTY));
+                ServerInfo serverInfo = new ServerInfo(requestData.getMyProxyUserName(),
registeredHost.getType().getHostAddress());
+
+                Cluster pbsCluster = null;
+                try {
+                    pbsCluster = new PBSCluster(serverInfo, authenticationInfo,
+                            (((HpcApplicationDeploymentType) jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath()));
+                } catch (SSHApiException e) {
+                    e.printStackTrace();  //To change body of catch statement use File |
Settings | File Templates.
+                }
+
+                context.setPbsCluster(pbsCluster);
+            }
 
             jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT,
context);
         } else if (registeredHost.getType() instanceof Ec2HostType) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 80dedcc..a2c3adb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -460,6 +460,7 @@
                 <module>modules/test-suite</module>
                 <module>modules/distribution</module>
                 <module>modules/integration-tests</module>
+                <module>modules/airavata-job-monitor</module>
             </modules>
         </profile>
         <profile>

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/tools/gsissh/src/main/java/SSHDemo.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/SSHDemo.java b/tools/gsissh/src/main/java/SSHDemo.java
index b33d682..688a150 100644
--- a/tools/gsissh/src/main/java/SSHDemo.java
+++ b/tools/gsissh/src/main/java/SSHDemo.java
@@ -79,6 +79,7 @@ public class SSHDemo {
             }
 
             Session session = jsch.getSession(user, host, port);
+            HostKey hostKey = session.getHostKey();
 
             java.util.Properties config = new java.util.Properties();
             config.put("StrictHostKeyChecking", "no");

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/GSSContextX509.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/GSSContextX509.java b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/GSSContextX509.java
index c03f93d..522acf2 100644
--- a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/GSSContextX509.java
+++ b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/GSSContextX509.java
@@ -55,8 +55,6 @@ public class GSSContextX509 implements com.jcraft.jsch.GSSContext {
     private GSSCredential credential;
 
     public void create(String user, String host) throws JSchException {
-        System.out.printf("Attempting GSI authentication for %s on %s\n", user, host);
-
         try {
 //			ExtendedGSSManager manager = (ExtendedGSSManager) ExtendedGSSManager.getInstance();
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/7849212b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/PBSCluster.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/PBSCluster.java b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/PBSCluster.java
index e07cdda..7a78b89 100644
--- a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/PBSCluster.java
+++ b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/PBSCluster.java
@@ -252,7 +252,8 @@ public class PBSCluster implements Cluster {
         String stdOutputString = jobIDReaderCommandOutput.getStdOutputString();
         String stdErrorString = jobIDReaderCommandOutput.getStdErrorString();
 
-        if(stdOutputString == null && "".equals(stdOutputString) || (stdErrorString
!= null )){
+        if (stdOutputString == null && "".equals(stdOutputString) ||
+                ((stdErrorString != null) && !("".equals(stdErrorString)))) {
             log.error("Standard Error output : " + stdErrorString);
             throw new SSHApiException(errorMsg + stdErrorString);
         }


Mime
View raw message