airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject git commit: changing the cancel job status properly.
Date Thu, 21 Aug 2014 20:04:22 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 21cae7eab -> 56b537519


changing the cancel job status properly.


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

Branch: refs/heads/master
Commit: 56b5375199aabd76cf6a2907e413020f55f766f0
Parents: 21cae7e
Author: lahiru <lahiru@apache.org>
Authored: Fri Aug 22 01:33:53 2014 +0530
Committer: lahiru <lahiru@apache.org>
Committed: Fri Aug 22 01:33:53 2014 +0530

----------------------------------------------------------------------
 .../monitor/impl/pull/qstat/HPCPullMonitor.java | 75 ++++++++++----------
 1 file changed, 39 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/56b53751/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
index 5dd8a15..4d9e4b6 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
@@ -173,55 +173,58 @@ public class HPCPullMonitor extends PullMonitor {
                         for(String cancelMId:cancelJobList) {
                             if (cancelMId.equals(iMonitorID.getExperimentID() + "+" + iMonitorID.getTaskID()))
{
                                 logger.info("Found a match in monitoring Queue, so marking
this job to remove from monitor queue " + cancelMId);
-                                logger.info("ExperimentID: " +  cancelMId.split("\\+")[0]+",TaskID:
"+cancelMId.split("\\+")[1]+"JobID"+iMonitorID.getJobID());
+                                logger.info("ExperimentID: " + cancelMId.split("\\+")[0]
+ ",TaskID: " + cancelMId.split("\\+")[1] + "JobID" + iMonitorID.getJobID());
                                 completedJobs.add(iMonitorID);
+                                iMonitorID.setStatus(JobState.CANCELED);
                             }
                         }
                     }
                     Map<String, JobState> jobStatuses = connection.getJobStatuses(monitorID);
                     for (MonitorID iMonitorID : monitorID) {
                         currentMonitorID = iMonitorID;
-                        iMonitorID.setStatus(jobStatuses.get(iMonitorID.getJobID()+","+iMonitorID.getJobName()));
   //IMPORTANT this is not a simple setter we have a logic
-                        jobStatus = new JobStatusChangeRequest(iMonitorID);
-                        // we have this JobStatus class to handle amqp monitoring
+                        if (!JobState.CANCELED.equals(iMonitorID.getStatus())) {
+                            iMonitorID.setStatus(jobStatuses.get(iMonitorID.getJobID() +
"," + iMonitorID.getJobName()));    //IMPORTANT this is not a simple setter we have a logic
+                        }
+                            jobStatus = new JobStatusChangeRequest(iMonitorID);
+                            // we have this JobStatus class to handle amqp monitoring
 
-                        publisher.publish(jobStatus);
-                        // if the job is completed we do not have to put the job to the queue
again
-                        iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
+                            publisher.publish(jobStatus);
+                            // if the job is completed we do not have to put the job to the
queue again
+                            iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
 
-                        // After successful monitoring perform follow   ing actions to cleanup
the queue, if necessary
-                        if (jobStatus.getState().equals(JobState.COMPLETE)) {
-                            completedJobs.add(iMonitorID);
-                            try {
-                                gfac.invokeOutFlowHandlers(iMonitorID.getJobExecutionContext());
-                            } catch (GFacException e) {
-                            	publisher.publish(new TaskStatusChangeRequest(new TaskIdentity(iMonitorID.getExperimentID(),
iMonitorID.getWorkflowNodeID(),
-										iMonitorID.getTaskID()), TaskState.FAILED));
-                            	//FIXME this is a case where the output retrieving fails even
if the job execution was a success. Thus updating the task status 
-                            	//should be done understanding whole workflow of job submission
and data transfer
+                            // After successful monitoring perform follow   ing actions to
cleanup the queue, if necessary
+                            if (jobStatus.getState().equals(JobState.COMPLETE)) {
+                                completedJobs.add(iMonitorID);
+                                try {
+                                    gfac.invokeOutFlowHandlers(iMonitorID.getJobExecutionContext());
+                                } catch (GFacException e) {
+                                    publisher.publish(new TaskStatusChangeRequest(new TaskIdentity(iMonitorID.getExperimentID(),
iMonitorID.getWorkflowNodeID(),
+                                            iMonitorID.getTaskID()), TaskState.FAILED));
+                                    //FIXME this is a case where the output retrieving fails
even if the job execution was a success. Thus updating the task status
+                                    //should be done understanding whole workflow of job
submission and data transfer
 //                            	publisher.publish(new ExperimentStatusChangedEvent(new ExperimentIdentity(iMonitorID.getExperimentID()),
 //										ExperimentState.FAILED));
-                                logger.info(e.getLocalizedMessage(), e);
-                            }
-                        } else if (iMonitorID.getFailedCount() > 2) {
-                            logger.error("Tried to monitor the job with ID " + iMonitorID.getJobID()
+ " But failed 3 times, so skip this Job from Monitor");
-                            iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
-                            completedJobs.add(iMonitorID);
-                            try {
-                                logger.error("Launching outflow handlers to check output
are genereated or not");
-                                gfac.invokeOutFlowHandlers(iMonitorID.getJobExecutionContext());
-                            } catch (GFacException e) {
-                                publisher.publish(new TaskStatusChangeRequest(new TaskIdentity(iMonitorID.getExperimentID(),
iMonitorID.getWorkflowNodeID(),
-                                        iMonitorID.getTaskID()), TaskState.FAILED));
-                                logger.info(e.getLocalizedMessage(), e);
+                                    logger.info(e.getLocalizedMessage(), e);
+                                }
+                            } else if (iMonitorID.getFailedCount() > 2) {
+                                logger.error("Tried to monitor the job with ID " + iMonitorID.getJobID()
+ " But failed 3 times, so skip this Job from Monitor");
+                                iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
+                                completedJobs.add(iMonitorID);
+                                try {
+                                    logger.error("Launching outflow handlers to check output
are genereated or not");
+                                    gfac.invokeOutFlowHandlers(iMonitorID.getJobExecutionContext());
+                                } catch (GFacException e) {
+                                    publisher.publish(new TaskStatusChangeRequest(new TaskIdentity(iMonitorID.getExperimentID(),
iMonitorID.getWorkflowNodeID(),
+                                            iMonitorID.getTaskID()), TaskState.FAILED));
+                                    logger.info(e.getLocalizedMessage(), e);
+                                }
+                            } else {
+                                // Evey
+                                iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
+                                // if the job is complete we remove it from the Map, if any
of these maps
+                                // get empty this userMonitorData will get delete from the
queue
                             }
-                        } else {
-                            // Evey
-                            iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
-                            // if the job is complete we remove it from the Map, if any of
these maps
-                            // get empty this userMonitorData will get delete from the queue
                         }
-                    }
                 } else {
                     logger.debug("Qstat Monitor doesn't handle non-gsissh hosts");
                 }


Mime
View raw message