airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject airavata git commit: Added email based monitoring implementation to gsissh provider
Date Wed, 08 Apr 2015 17:34:48 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 5e77e4b5f -> bf0fddb05


Added email based monitoring implementation to gsissh provider


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

Branch: refs/heads/master
Commit: bf0fddb05a6fb8f61bb542e9852d252d55af55ae
Parents: 5e77e4b
Author: shamrath <shameerainfo@gmail.com>
Authored: Wed Apr 8 13:35:28 2015 -0400
Committer: shamrath <shameerainfo@gmail.com>
Committed: Wed Apr 8 13:35:28 2015 -0400

----------------------------------------------------------------------
 modules/gfac/gfac-gsissh/pom.xml                |  6 ++
 .../gsissh/provider/impl/GSISSHProvider.java    | 71 +++++++++++---------
 2 files changed, 47 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/bf0fddb0/modules/gfac/gfac-gsissh/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/pom.xml b/modules/gfac/gfac-gsissh/pom.xml
index dc96412..0766a75 100644
--- a/modules/gfac/gfac-gsissh/pom.xml
+++ b/modules/gfac/gfac-gsissh/pom.xml
@@ -23,6 +23,12 @@
     <url>http://airavata.apache.org/</url>
 
     <dependencies>
+
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-gfac-email-monitor</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <!-- Logging -->
         <dependency>
             <groupId>org.slf4j</groupId>

http://git-wip-us.apache.org/repos/asf/airavata/blob/bf0fddb0/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 e9569dc..2b23596 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
@@ -22,6 +22,7 @@ package org.apache.airavata.gfac.gsissh.provider.impl;
 
 import org.airavata.appcatalog.cpi.AppCatalog;
 import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.gfac.ExecutionMode;
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.core.context.JobExecutionContext;
@@ -34,6 +35,7 @@ import org.apache.airavata.gfac.core.provider.GFacProviderException;
 import org.apache.airavata.gfac.core.utils.GFacUtils;
 import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
 import org.apache.airavata.gfac.gsissh.util.GFACGSISSHUtils;
+import org.apache.airavata.gfac.monitor.email.EmailBasedMonitor;
 import org.apache.airavata.gsi.ssh.api.Cluster;
 import org.apache.airavata.gsi.ssh.api.SSHApiException;
 import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
@@ -137,38 +139,47 @@ public class GSISSHProvider extends AbstractRecoverableProvider {
     }
 
     public void delegateToMonitorHandlers(JobExecutionContext jobExecutionContext, SSHJobSubmission
sshJobSubmission, String jobID) throws GFacHandlerException {
-        List<ThreadedHandler> daemonHandlers = BetterGfacImpl.getDaemonHandlers();
-        if (daemonHandlers == null) {
-            daemonHandlers = BetterGfacImpl.getDaemonHandlers();
-        }
-        ThreadedHandler pullMonitorHandler = null;
-        ThreadedHandler pushMonitorHandler = null;
-        MonitorMode monitorMode = sshJobSubmission.getMonitorMode();
-        for (ThreadedHandler threadedHandler : daemonHandlers) {
-            if ("org.apache.airavata.gfac.monitor.handlers.GridPullMonitorHandler".equals(threadedHandler.getClass().getName()))
{
-                pullMonitorHandler = threadedHandler;
-                if (monitorMode == null || monitorMode == MonitorMode.POLL_JOB_MANAGER) {
-                    log.info("Job is launched successfully now parsing it to monitoring in
pull mode, JobID Returned:  " + jobID);
-                    pullMonitorHandler.invoke(jobExecutionContext);
-                } else {
-                    log.error("Currently we only support Pull and Push monitoring and monitorMode
should be PULL" +
-                            " to handle by the GridPullMonitorHandler");
-                }
-            } else if ("org.apache.airavata.gfac.monitor.handlers.GridPushMonitorHandler".equals(threadedHandler.getClass().getName()))
{
-                pushMonitorHandler = threadedHandler;
-                if (monitorMode == null || monitorMode == MonitorMode.XSEDE_AMQP_SUBSCRIBE)
{
-                    log.info("Job is launched successfully now parsing it to monitoring in
push mode, JobID Returned:  " + jobID);
-                    pushMonitorHandler.invoke(jobExecutionContext);
-                } else {
-                    log.error("Currently we only support Pull and Push monitoring and monitorMode
should be PUSH" +
-                            " to handle by the GridPushMonitorHandler");
+        if (ServerSettings.isEmailBasedNotificationEnable()) {
+            try {
+                EmailBasedMonitor emailBasedMonitor = EmailBasedMonitor.getInstant(BetterGfacImpl.getMonitorPublisher());
+                emailBasedMonitor.addToJobMonitorMap(jobExecutionContext);
+            } catch (ApplicationSettingsException e) {
+                throw new GFacHandlerException("Error while delegating job execution context
to email based monitor");
+            }
+        } else {
+            List<ThreadedHandler> daemonHandlers = BetterGfacImpl.getDaemonHandlers();
+            if (daemonHandlers == null) {
+                daemonHandlers = BetterGfacImpl.getDaemonHandlers();
+            }
+            ThreadedHandler pullMonitorHandler = null;
+            ThreadedHandler pushMonitorHandler = null;
+            MonitorMode monitorMode = sshJobSubmission.getMonitorMode();
+            for (ThreadedHandler threadedHandler : daemonHandlers) {
+                if ("org.apache.airavata.gfac.monitor.handlers.GridPullMonitorHandler".equals(threadedHandler.getClass().getName()))
{
+                    pullMonitorHandler = threadedHandler;
+                    if (monitorMode == null || monitorMode == MonitorMode.POLL_JOB_MANAGER)
{
+                        log.info("Job is launched successfully now parsing it to monitoring
in pull mode, JobID Returned:  " + jobID);
+                        pullMonitorHandler.invoke(jobExecutionContext);
+                    } else {
+                        log.error("Currently we only support Pull and Push monitoring and
monitorMode should be PULL" +
+                                " to handle by the GridPullMonitorHandler");
+                    }
+                } else if ("org.apache.airavata.gfac.monitor.handlers.GridPushMonitorHandler".equals(threadedHandler.getClass().getName()))
{
+                    pushMonitorHandler = threadedHandler;
+                    if (monitorMode == null || monitorMode == MonitorMode.XSEDE_AMQP_SUBSCRIBE)
{
+                        log.info("Job is launched successfully now parsing it to monitoring
in push mode, JobID Returned:  " + jobID);
+                        pushMonitorHandler.invoke(jobExecutionContext);
+                    } else {
+                        log.error("Currently we only support Pull and Push monitoring and
monitorMode should be PUSH" +
+                                " to handle by the GridPushMonitorHandler");
+                    }
                 }
+                // have to handle the GridPushMonitorHandler logic
+            }
+            if (pullMonitorHandler == null && pushMonitorHandler == null &&
ExecutionMode.ASYNCHRONOUS.equals(jobExecutionContext.getGFacConfiguration().getExecutionMode()))
{
+                log.error("No Daemon handler is configured in gfac-config.xml, either pull
or push, so monitoring will not invoked" +
+                        ", execution is configured as asynchronous, so Outhandler will not
be invoked");
             }
-            // have to handle the GridPushMonitorHandler logic
-        }
-        if (pullMonitorHandler == null && pushMonitorHandler == null && ExecutionMode.ASYNCHRONOUS.equals(jobExecutionContext.getGFacConfiguration().getExecutionMode()))
{
-            log.error("No Daemon handler is configured in gfac-config.xml, either pull or
push, so monitoring will not invoked" +
-                    ", execution is configured as asynchronous, so Outhandler will not be
invoked");
         }
     }
 


Mime
View raw message