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 experiment Id to status update log messages.
Date Tue, 26 May 2015 18:35:58 GMT
Repository: airavata
Updated Branches:
  refs/heads/master a23a9cc01 -> 9f3d55bdd


Added experiment Id to status update log messages.


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

Branch: refs/heads/master
Commit: 9f3d55bdd766e6e147fa1372d9598c6d21578145
Parents: a23a9cc
Author: Shameera Rathanyaka <shameerainfo@gmail.com>
Authored: Tue May 26 14:35:37 2015 -0400
Committer: Shameera Rathanyaka <shameerainfo@gmail.com>
Committed: Tue May 26 14:35:37 2015 -0400

----------------------------------------------------------------------
 .../core/monitor/AiravataJobStatusUpdator.java  | 27 ++++++++++++--------
 .../core/monitor/AiravataTaskStatusUpdator.java |  8 +++---
 .../AiravataWorkflowNodeStatusUpdator.java      | 15 ++++++-----
 .../gfac/monitor/email/EmailBasedMonitor.java   |  3 ++-
 4 files changed, 32 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/9f3d55bd/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java
index 0af8df0..d5b917b 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java
@@ -21,6 +21,8 @@
 package org.apache.airavata.gfac.core.monitor;
 
 import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.common.logger.AiravataLogger;
+import org.apache.airavata.common.logger.AiravataLoggerFactory;
 import org.apache.airavata.common.utils.AiravataUtils;
 import org.apache.airavata.common.utils.MonitorPublisher;
 import org.apache.airavata.common.utils.ServerSettings;
@@ -67,8 +69,10 @@ public class AiravataJobStatusUpdator implements AbstractActivityListener
{
             try {
                 String taskID = jobStatus.getJobIdentity().getTaskId();
                 String jobID = jobStatus.getJobIdentity().getJobId();
-                updateJobStatus(taskID, jobID, state);
-    			logger.debug("Publishing job status for "+jobStatus.getJobIdentity().getJobId()+":"+state.toString());
+                String expId = jobStatus.getJobIdentity().getExperimentId();
+                updateJobStatus(expId,taskID, jobID, state);
+    			logger.debug("expId - {}: Publishing job status for " + jobStatus.getJobIdentity().getJobId()
+ ":"
+                        + state.toString(),jobStatus.getJobIdentity().getExperimentId());
                 JobStatusChangeEvent event = new JobStatusChangeEvent(jobStatus.getState(),
jobStatus.getJobIdentity());
                 monitorPublisher.publish(event);
                 String messageId = AiravataUtils.getId("JOB");
@@ -76,30 +80,31 @@ public class AiravataJobStatusUpdator implements AbstractActivityListener
{
                 msgCntxt.setUpdatedTime(AiravataUtils.getCurrentTimestamp());
                 publisher.publish(msgCntxt);
             } catch (Exception e) {
-                logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+                logger.error("expId - " + jobStatus.getJobIdentity().getExperimentId() +
": Error persisting data"
+                        + e.getLocalizedMessage(), e);
                 throw new Exception("Error persisting job status..", e);
             }
         }
     }
 
-    public  void updateJobStatus(String taskId, String jobID, JobState state) throws Exception
{
-		logger.info("Updating job status for " + jobID + ":" + state.toString());
+    public  void updateJobStatus(String expId, String taskId, String jobID, JobState state)
throws Exception {
+        logger.info("expId - {}: Updating job status for " + jobID + ":" + state.toString(),
expId);
         CompositeIdentifier ids = new CompositeIdentifier(taskId, jobID);
-        JobDetails details = (JobDetails)airavataRegistry.get(RegistryModelType.JOB_DETAIL,
ids);
-        if(details == null) {
+        JobDetails details = (JobDetails) airavataRegistry.get(RegistryModelType.JOB_DETAIL,
ids);
+        if (details == null) {
             details = new JobDetails();
         }
         org.apache.airavata.model.workspace.experiment.JobStatus status = new org.apache.airavata.model.workspace.experiment.JobStatus();
-        if(JobState.CANCELED.equals(details.getJobStatus().getJobState())||
+        if (JobState.CANCELED.equals(details.getJobStatus().getJobState()) ||
                 JobState.CANCELING.equals(details.getJobStatus().getJobState())) {
             status.setJobState(details.getJobStatus().getJobState());
-        }else{
-        	 status.setJobState(state);
+        } else {
+            status.setJobState(state);
         }
         status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
         details.setJobStatus(status);
         details.setJobID(jobID);
-        logger.debug("Updating job status for "+jobID+":"+details.getJobStatus().toString());
+        logger.debug("expId - {}: Updated job status for " + jobID + ":" + details.getJobStatus().toString(),
expId);
         airavataRegistry.update(RegistryModelType.JOB_STATUS, status, ids);
     }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/9f3d55bd/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java
index 65ac274..90392d6 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java
@@ -56,7 +56,8 @@ public class AiravataTaskStatusUpdator implements AbstractActivityListener
{
     public void setupTaskStatus(TaskStatusChangeRequestEvent taskStatus) throws Exception{
     	try {
 			updateTaskStatus(taskStatus.getTaskIdentity().getTaskId(), taskStatus.getState());
-			logger.debug("Publishing task status for "+taskStatus.getTaskIdentity().getTaskId()+":"+taskStatus.getState().toString());
+            logger.debug("expId - {}: Publishing task status for " + taskStatus.getTaskIdentity().getTaskId()
+ ":"
+                    + taskStatus.getState().toString(), taskStatus.getTaskIdentity().getExperimentId());
             TaskStatusChangeEvent event = new TaskStatusChangeEvent(taskStatus.getState(),
taskStatus.getTaskIdentity());
             monitorPublisher.publish(event);
             String messageId = AiravataUtils.getId("TASK");
@@ -95,7 +96,8 @@ public class AiravataTaskStatusUpdator implements AbstractActivityListener
{
     	}
     	try {
 			updateTaskStatus(jobStatus.getJobIdentity().getTaskId(), state);
-			logger.debug("Publishing task status for "+jobStatus.getJobIdentity().getTaskId()+":"+state.toString());
+            logger.debug("expId - {}: Publishing task status for " + jobStatus.getJobIdentity().getTaskId()
+ ":"
+                    + state.toString(), jobStatus.getJobIdentity().getExperimentId());
             TaskIdentifier taskIdentity = new TaskIdentifier(jobStatus.getJobIdentity().getTaskId(),
                                                          jobStatus.getJobIdentity().getWorkflowNodeId(),
                                                          jobStatus.getJobIdentity().getExperimentId(),
@@ -108,7 +110,7 @@ public class AiravataTaskStatusUpdator implements AbstractActivityListener
{
             publisher.publish(msgCntxt);
 
         }  catch (Exception e) {
-            logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+            logger.error("expId - " + jobStatus.getJobIdentity().getExperimentId() + ": Error
persisting data" + e.getLocalizedMessage(), e);
             throw new Exception("Error persisting task status..", e);
 		}
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/9f3d55bd/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
index 8f53c66..c32742a 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
@@ -81,8 +81,10 @@ public class AiravataWorkflowNodeStatusUpdator implements AbstractActivityListen
 			return;
     	}
     	try {
-			updateWorkflowNodeStatus(taskStatus.getTaskIdentity().getWorkflowNodeId(), state);
-			logger.debug("Publishing workflow node status for "+taskStatus.getTaskIdentity().getWorkflowNodeId()+":"+state.toString());
+            String expId = taskStatus.getTaskIdentity().getExperimentId();
+			updateWorkflowNodeStatus(expId, taskStatus.getTaskIdentity().getWorkflowNodeId(), state);
+            logger.debug("expId - {}: Publishing workflow node status for " + taskStatus.getTaskIdentity().getWorkflowNodeId()
+                    + ":" + state.toString(), taskStatus.getTaskIdentity().getExperimentId());
             WorkflowIdentifier workflowIdentity = new WorkflowIdentifier(taskStatus.getTaskIdentity().getWorkflowNodeId(),
                                                                          taskStatus.getTaskIdentity().getExperimentId(),
                                                                          taskStatus.getTaskIdentity().getGatewayId());
@@ -94,13 +96,14 @@ public class AiravataWorkflowNodeStatusUpdator implements AbstractActivityListen
 
             publisher.publish(msgCntxt);
 		} catch (Exception e) {
-            logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+            logger.error("expId - " + taskStatus.getTaskIdentity().getExperimentId() + ":
Error persisting data"
+                    + e.getLocalizedMessage(), e);
             throw new Exception("Error persisting workflow node status..", e);
-		}
+        }
     }
 
-    public  void updateWorkflowNodeStatus(String workflowNodeId, WorkflowNodeState state)
throws Exception {
-		logger.info("Updating workflow node status for "+workflowNodeId+":"+state.toString());
+    public  void updateWorkflowNodeStatus(String experimentId, String workflowNodeId, WorkflowNodeState
state) throws Exception {
+		logger.info("expId - {}: Updating workflow node status for "+workflowNodeId+":"+state.toString(),
experimentId);
     	WorkflowNodeDetails details = (WorkflowNodeDetails)airavataRegistry.get(RegistryModelType.WORKFLOW_NODE_DETAIL,
workflowNodeId);
         if(details == null) {
             details = new WorkflowNodeDetails();

http://git-wip-us.apache.org/repos/asf/airavata/blob/9f3d55bd/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 0c94daa..535a8b3 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
@@ -308,7 +308,8 @@ public class EmailBasedMonitor implements Runnable{
         jobStatus.setJobIdentity(jobIdentity);
         jobStatus.setState(jobExecutionContext.getJobDetails().getJobStatus().getJobState());
         // we have this JobStatus class to handle amqp monitoring
-        log.debugId(jobStatus.getJobIdentity().getJobId(), "[EJM]: Published job status change
request, " +
+        log.debugId(jobStatus.getJobIdentity().getJobId(), "[EJM]: Published job status("
+
+                        jobExecutionContext.getJobDetails().getJobStatus().getJobState().toString()
+ ") change request, " +
                         "experiment {} , task {}", jobStatus.getJobIdentity().getExperimentId(),
                 jobStatus.getJobIdentity().getTaskId());
 


Mime
View raw message