airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [1/2] airavata git commit: Added jobName as monitor id in email search in case compute resource return null for jobId
Date Fri, 24 Apr 2015 17:58:52 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 02aa95bd0 -> a665aa56a


Added jobName as monitor id in email search in case compute resource return null for jobId


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

Branch: refs/heads/master
Commit: ccdf5c40f889bc50ed15b22db1629ba374fe876b
Parents: 73da33a
Author: shamrath <shameerainfo@gmail.com>
Authored: Fri Apr 24 13:58:17 2015 -0400
Committer: shamrath <shameerainfo@gmail.com>
Committed: Fri Apr 24 13:58:17 2015 -0400

----------------------------------------------------------------------
 .../gfac/monitor/email/EmailBasedMonitor.java        | 15 +++++++++++----
 .../airavata/gfac/monitor/email/JobStatusResult.java | 11 +++++++++++
 .../gfac/monitor/email/parser/EmailParser.java       |  1 +
 .../gfac/monitor/email/parser/PBSEmailParser.java    |  5 +++--
 .../gfac/monitor/email/parser/SLURMEmailParser.java  |  5 +++--
 5 files changed, 29 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/ccdf5c40/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/EmailBasedMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/EmailBasedMonitor.java
b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/EmailBasedMonitor.java
index c0fd195..5fce761 100644
--- a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/EmailBasedMonitor.java
+++ b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/EmailBasedMonitor.java
@@ -91,12 +91,16 @@ public class EmailBasedMonitor implements Runnable{
     }
 
     public void addToJobMonitorMap(JobExecutionContext jobExecutionContext) {
-        addToJobMonitorMap(jobExecutionContext.getJobDetails().getJobID(), jobExecutionContext);
+        String monitorId = jobExecutionContext.getJobDetails().getJobID();
+        if (monitorId == null || monitorId.isEmpty()) {
+            monitorId = jobExecutionContext.getJobDetails().getJobName();
+        }
+        addToJobMonitorMap(monitorId, jobExecutionContext);
     }
 
-    public void addToJobMonitorMap(String jobId, JobExecutionContext jobExecutionContext)
{
-        log.info("Added Job Id : " + jobId + " to email based monitor map");
-        jobMonitorMap.put(jobId, jobExecutionContext);
+    public void addToJobMonitorMap(String monitorId, JobExecutionContext jobExecutionContext)
{
+        log.info("Added monitor Id : " + monitorId + " to email based monitor map");
+        jobMonitorMap.put(monitorId, jobExecutionContext);
     }
 
     private JobStatusResult parse(Message message) throws MessagingException, AiravataException
{
@@ -180,6 +184,9 @@ public class EmailBasedMonitor implements Runnable{
             try {
                 JobStatusResult jobStatusResult = parse(message);
                 JobExecutionContext jEC = jobMonitorMap.get(jobStatusResult.getJobId());
+                if (jEC == null) {
+                    jEC = jobMonitorMap.get(jobStatusResult.getJobName());
+                }
                 if (jEC != null) {
                     process(jobStatusResult, jEC);
                     processedMessages.add(message);

http://git-wip-us.apache.org/repos/asf/airavata/blob/ccdf5c40/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/JobStatusResult.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/JobStatusResult.java
b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/JobStatusResult.java
index 9145993..321b9cc 100644
--- a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/JobStatusResult.java
+++ b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/JobStatusResult.java
@@ -26,6 +26,16 @@ public class JobStatusResult {
     private JobState state;
     private String jobId;
 
+    public String getJobName() {
+        return jobName;
+    }
+
+    public void setJobName(String jobName) {
+        this.jobName = jobName;
+    }
+
+    private String jobName;
+
     public JobState getState() {
         return state;
     }
@@ -42,3 +52,4 @@ public class JobStatusResult {
         this.jobId = jobId;
     }
 }
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/ccdf5c40/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/EmailParser.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/EmailParser.java
b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/EmailParser.java
index 84899f0..d82ce50 100644
--- a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/EmailParser.java
+++ b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/EmailParser.java
@@ -29,6 +29,7 @@ import javax.mail.MessagingException;
 public interface EmailParser {
     static final String STATUS = "status";
     static final String JOBID = "jobId";
+    static final String JOBNAME = "jobName";
     static final String EXIT_STATUS = "exitStatus";
 
     JobStatusResult parseEmail(Message message) throws MessagingException, AiravataException;

http://git-wip-us.apache.org/repos/asf/airavata/blob/ccdf5c40/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/PBSEmailParser.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/PBSEmailParser.java
b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/PBSEmailParser.java
index b5f543b..bb715d5 100644
--- a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/PBSEmailParser.java
+++ b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/PBSEmailParser.java
@@ -37,8 +37,8 @@ public class PBSEmailParser implements EmailParser {
     private static final Logger log = LoggerFactory.getLogger(PBSEmailParser.class);
 
 
-    private static final String REGEX = "[a-zA-Z: ]*(?<" + JOBID + ">[a-zA-Z0-9-\\.]*)\\s+.*\\s+.*\\s+(?<"
-            + STATUS + ">[a-zA-Z\\ ]*)";
+    private static final String REGEX = "[a-zA-Z ]*:[ ]*(?<" +  JOBID + ">[a-zA-Z0-9-\\.]*)\\s+[a-zA-Z
]*:[ ]*(?<"+
+            JOBNAME + ">[a-zA-Z0-9-\\.]*)\\s+.*\\s+(?<" + STATUS + ">[a-zA-Z\\ ]*)";
     private static final String REGEX_EXIT_STATUS = "Exit_status=(?<" + EXIT_STATUS +
">[\\d]+)";
     public static final String BEGUN_EXECUTION = "Begun execution";
     public static final String EXECUTION_TERMINATED = "Execution terminated";
@@ -54,6 +54,7 @@ public class PBSEmailParser implements EmailParser {
             Matcher matcher = pattern.matcher(content);
             if (matcher.find()) {
                 jobStatusResult.setJobId(matcher.group(JOBID));
+                jobStatusResult.setJobName(matcher.group(JOBNAME));
                 String statusLine = matcher.group(STATUS);
                 jobStatusResult.setState(getJobState(statusLine, content));
                 return jobStatusResult;

http://git-wip-us.apache.org/repos/asf/airavata/blob/ccdf5c40/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/SLURMEmailParser.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/SLURMEmailParser.java
b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/SLURMEmailParser.java
index 47e78a7..f2182f9 100644
--- a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/SLURMEmailParser.java
+++ b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/SLURMEmailParser.java
@@ -35,8 +35,8 @@ public class SLURMEmailParser implements EmailParser {
 
     private static final Logger log = LoggerFactory.getLogger(SLURMEmailParser.class);
 
-    private static final String REGEX = "[A-Z]*\\s[a-zA-Z]*_[a-z]*=(?<" + JOBID
-            + ">\\d*)\\s[a-zA-Z]*=[a-zA-Z0-9-]*\\s(?<" + STATUS + ">[]a-zA-Z]*),.*";
+    private static final String REGEX = "[A-Z]*\\s[a-zA-Z]*_[a-z]*=(?<" + JOBID + ">\\d*)[
]*[a-zA-Z]*=(?<"+
+            JOBNAME + ">[a-zA-Z0-9-]*)[ ]*(?<" + STATUS + ">[]a-zA-Z]*),.*";
 
     public static final String BEGAN = "Began";
     public static final String ENDED = "Ended";
@@ -50,6 +50,7 @@ public class SLURMEmailParser implements EmailParser {
         Matcher matcher = pattern.matcher(subject);
         if (matcher.find()) {
             jobStatusResult.setJobId(matcher.group(JOBID));
+            jobStatusResult.setJobName(matcher.group(JOBNAME));
             jobStatusResult.setState(getJobState(matcher.group(STATUS)));
             return jobStatusResult;
         } else {


Mime
View raw message