airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [18/20] airavata git commit: Fixed jobstatus update issue in aurora monitor service :
Date Wed, 02 Nov 2016 03:30:29 GMT
Fixed jobstatus update issue in aurora monitor service
:


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

Branch: refs/heads/auroraMesosIntegration
Commit: 30f187ad5dcc5e021e9f0471a394f52afa3ae36f
Parents: c64d0f0
Author: Shameera Rathnayaka <shameerainfo@gmail.com>
Authored: Tue Nov 1 23:03:02 2016 -0400
Committer: Shameera Rathnayaka <shameerainfo@gmail.com>
Committed: Tue Nov 1 23:03:02 2016 -0400

----------------------------------------------------------------------
 .../gfac/monitor/cloud/AuroraJobMonitor.java        | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/30f187ad/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/cloud/AuroraJobMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/cloud/AuroraJobMonitor.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/cloud/AuroraJobMonitor.java
index 9e24597..e283eee 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/cloud/AuroraJobMonitor.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/cloud/AuroraJobMonitor.java
@@ -40,6 +40,7 @@ import org.apache.airavata.model.status.ProcessState;
 import org.apache.airavata.model.status.ProcessStatus;
 import org.apache.airavata.model.status.TaskState;
 import org.apache.airavata.model.status.TaskStatus;
+import org.apache.airavata.registry.cpi.CompositeIdentifier;
 import org.apache.airavata.registry.cpi.ExperimentCatalog;
 import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
 import org.apache.airavata.registry.cpi.RegistryException;
@@ -167,17 +168,19 @@ public class AuroraJobMonitor implements JobMonitor, Runnable {
         private void updateStatus(String jobKey, TaskContext taskContext, JobState jobState)
{
             ProcessContext pc = taskContext.getParentProcessContext();
             ExperimentCatalog experimentCatalog = pc.getExperimentCatalog();
-            List<Object> objects = null;
+            Object object;
+            JobStatus prevJobStatus = null;
             try {
-                objects = experimentCatalog.get(ExperimentCatalogModelType.JOB_STATUS, taskContext.getTaskId(),
jobKey);
+                CompositeIdentifier ci = new CompositeIdentifier(taskContext.getTaskId(),
jobKey);
+                object = experimentCatalog.get(ExperimentCatalogModelType.JOB_STATUS, ci);
+                if (object instanceof JobStatus) {
+                    prevJobStatus = ((JobStatus) object);
+                }
             } catch (RegistryException e) {
                 log.error("Error while getting job statuses for job : {} , task : {}, process
: {}", jobKey,
                         taskContext.getTaskId(), pc.getProcessId());
             }
-            List<JobState> jobStatuses = objects.stream()
-                    .map(o -> ((JobStatus) o).getJobState())
-                    .collect(Collectors.toList());
-            if (!jobStatuses.contains(jobState)) {
+            if (prevJobStatus == null || prevJobStatus.getJobState() != jobState) {
                 JobStatus jobStatus = new JobStatus(jobState);
                 jobStatus.setReason("Aurora return " + jobState.name());
                 jobStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
@@ -190,6 +193,7 @@ public class AuroraJobMonitor implements JobMonitor, Runnable {
                             jobState.name(), jobKey, taskContext.getTaskId(), pc.getProcessId(),
pc.getExperimentId());
                 }
             }
+
         }
 
         private void processJob(String jobKey, TaskContext taskContext, JobState jobState)
{


Mime
View raw message