airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject [1/2] git commit: fixing AIRAVATA-1184
Date Wed, 21 May 2014 14:53:11 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 179367235 -> 61dd0fcb2


fixing AIRAVATA-1184


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

Branch: refs/heads/master
Commit: ee50805cf1e19dd1a15f33451feb5a5fe63d2604
Parents: 2710f6e
Author: lahiru <lahiru@apache.org>
Authored: Wed May 21 10:48:32 2014 -0400
Committer: lahiru <lahiru@apache.org>
Committed: Wed May 21 10:48:32 2014 -0400

----------------------------------------------------------------------
 .../apache/airavata/gfac/core/cpi/GFacImpl.java | 30 +++++++--
 .../airavata/gfac/core/monitor/MonitorID.java   | 66 +++++++++++---------
 .../airavata/gfac/monitor/HPCMonitorID.java     |  9 +--
 .../server/OrchestratorServerHandler.java       |  2 -
 4 files changed, 64 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/ee50805c/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFacImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFacImpl.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFacImpl.java
index ddcf775..dca4684 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFacImpl.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFacImpl.java
@@ -42,7 +42,10 @@ import org.apache.airavata.gfac.Scheduler;
 import org.apache.airavata.gfac.core.context.ApplicationContext;
 import org.apache.airavata.gfac.core.context.JobExecutionContext;
 import org.apache.airavata.gfac.core.context.MessageContext;
-import org.apache.airavata.gfac.core.monitor.AbstractActivityListener;
+import org.apache.airavata.gfac.core.monitor.*;
+import org.apache.airavata.gfac.core.monitor.state.ExperimentStatusChangeRequest;
+import org.apache.airavata.gfac.core.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.gfac.core.monitor.state.TaskStatusChangeRequest;
 import org.apache.airavata.gfac.core.notification.MonitorPublisher;
 import org.apache.airavata.gfac.core.notification.events.ExecutionFailEvent;
 import org.apache.airavata.gfac.core.notification.listeners.LoggingListener;
@@ -54,9 +57,7 @@ import org.apache.airavata.gfac.core.handler.GFacHandlerConfig;
 import org.apache.airavata.gfac.core.handler.GFacHandlerException;
 import org.apache.airavata.gfac.core.handler.ThreadedHandler;
 import org.apache.airavata.gfac.core.utils.GFacUtils;
-import org.apache.airavata.model.workspace.experiment.DataObjectType;
-import org.apache.airavata.model.workspace.experiment.Experiment;
-import org.apache.airavata.model.workspace.experiment.TaskDetails;
+import org.apache.airavata.model.workspace.experiment.*;
 import org.apache.airavata.registry.api.AiravataRegistry2;
 import org.apache.airavata.registry.cpi.RegistryModelType;
 import org.apache.airavata.registry.cpi.Registry;
@@ -304,10 +305,29 @@ public class GFacImpl implements GFac {
                 executeProvider(provider, jobExecutionContext);
                 disposeProvider(provider, jobExecutionContext);
             }
-            if(GFacUtils.isSynchronousMode(jobExecutionContext)){
+            if (GFacUtils.isSynchronousMode(jobExecutionContext)) {
                 invokeOutFlowHandlers(jobExecutionContext);
             }
         } catch (Exception e) {
+            try {
+                // we make the experiment as failed due to exception scenario
+                monitorPublisher.publish(new
+                        ExperimentStatusChangeRequest(new ExperimentIdentity(jobExecutionContext.getExperimentID()),
+                        ExperimentState.FAILED));
+                // Updating the task status if there's any task associated
+                monitorPublisher.publish(new TaskStatusChangeRequest(
+                        new TaskIdentity(jobExecutionContext.getExperimentID(),
+                                jobExecutionContext.getWorkflowNodeDetails().getNodeInstanceId(),
+                                jobExecutionContext.getTaskData().getTaskID()), TaskState.FAILED
+                ));
+                monitorPublisher.publish(new JobStatusChangeRequest(new MonitorID(jobExecutionContext),
+                        new JobIdentity(jobExecutionContext.getExperimentID(),
+                        jobExecutionContext.getWorkflowNodeDetails().getNodeInstanceId(),
+                        jobExecutionContext.getTaskData().getTaskID(), jobExecutionContext.getJobDetails().getJobID()),
JobState.FAILED));
+            } catch (NullPointerException e1) {
+                log.error("Error occured during updating the statuses of Experiments,tasks
or Job statuses to failed, " +
+                        "NullPointerException occurred because at this point there might
not have Job Created", e1, e);
+            }
             jobExecutionContext.setProperty(ERROR_SENT, "true");
             jobExecutionContext.getNotifier().publish(new ExecutionFailEvent(e.getCause()));
             throw new GFacException(e.getMessage(), e);

http://git-wip-us.apache.org/repos/asf/airavata/blob/ee50805c/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
index beb1f93..dfd9de9 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
@@ -64,7 +64,7 @@ public class MonitorID {
     public MonitorID() {
     }
 
-    public MonitorID(HostDescription host, String jobID,String taskID, String workflowNodeID,
String experimentID, String userName) {
+    public MonitorID(HostDescription host, String jobID, String taskID, String workflowNodeID,
String experimentID, String userName) {
         this.host = host;
         this.jobStartedTime = new Timestamp((new Date()).getTime());
         this.userName = userName;
@@ -74,6 +74,16 @@ public class MonitorID {
         this.workflowNodeID = workflowNodeID;
     }
 
+    public MonitorID(JobExecutionContext jobExecutionContext) {
+        this.jobExecutionContext = jobExecutionContext;
+        host = jobExecutionContext.getApplicationContext().getHostDescription();
+        userName = jobExecutionContext.getExperiment().getUserName();
+        jobID = jobExecutionContext.getJobDetails().getJobID();
+        taskID = jobExecutionContext.getTaskData().getTaskID();
+        experimentID = jobExecutionContext.getExperiment().getExperimentID();
+        workflowNodeID = jobExecutionContext.getWorkflowNodeDetails().getNodeInstanceId();//
at this point we only have one node todo: fix this
+    }
+
     public HostDescription getHost() {
         return host;
     }
@@ -114,7 +124,7 @@ public class MonitorID {
         this.jobStartedTime = jobStartedTime;
     }
 
-    public void addParameter(String key,Object value) {
+    public void addParameter(String key, Object value) {
         this.parameters.put(key, value);
     }
 
@@ -162,38 +172,38 @@ public class MonitorID {
         // this logic is going to be useful for fast finishing jobs
         // because in some machines job state vanishes quicckly when the job is done
         // during that case job state comes as unknown.so we handle it here.
-            if (this.state != null && status.equals(JobState.UNKNOWN)) {
-                if (getFailedCount() > 2) {
-                    switch (this.state) {
-                        case ACTIVE:
-                            this.state = JobState.COMPLETE;
-                            break;
-                        case QUEUED:
-                            this.state = JobState.COMPLETE;
-                            break;
-                    }
-                } else {
-                    try {
-                        // when state becomes unknown we sleep for a while
-                        Thread.sleep(10000);
-                    } catch (InterruptedException e) {
-                        e.printStackTrace();  //To change body of catch statement use File
| Settings | File Templates.
-                    }
-                    setFailedCount(getFailedCount() + 1);
+        if (this.state != null && status.equals(JobState.UNKNOWN)) {
+            if (getFailedCount() > 2) {
+                switch (this.state) {
+                    case ACTIVE:
+                        this.state = JobState.COMPLETE;
+                        break;
+                    case QUEUED:
+                        this.state = JobState.COMPLETE;
+                        break;
                 }
             } else {
-                // normal scenario
-                this.state = status;
+                try {
+                    // when state becomes unknown we sleep for a while
+                    Thread.sleep(10000);
+                } catch (InterruptedException e) {
+                    e.printStackTrace();  //To change body of catch statement use File |
Settings | File Templates.
+                }
+                setFailedCount(getFailedCount() + 1);
             }
+        } else {
+            // normal scenario
+            this.state = status;
+        }
     }
 
-	public String getWorkflowNodeID() {
-		return workflowNodeID;
-	}
+    public String getWorkflowNodeID() {
+        return workflowNodeID;
+    }
 
-	public void setWorkflowNodeID(String workflowNodeID) {
-		this.workflowNodeID = workflowNodeID;
-	}
+    public void setWorkflowNodeID(String workflowNodeID) {
+        this.workflowNodeID = workflowNodeID;
+    }
 
     public JobExecutionContext getJobExecutionContext() {
         return jobExecutionContext;

http://git-wip-us.apache.org/repos/asf/airavata/blob/ee50805c/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
index 942f6ae..cc6ab30 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
@@ -73,15 +73,8 @@ public class HPCMonitorID extends MonitorID {
     }
 
     public HPCMonitorID(AuthenticationInfo authenticationInfo, JobExecutionContext jobExecutionContext)
{
+        super(jobExecutionContext);
         this.authenticationInfo = authenticationInfo;
-        this.jobExecutionContext = jobExecutionContext;
-        host = jobExecutionContext.getApplicationContext().getHostDescription();
-        userName = jobExecutionContext.getExperiment().getUserName();
-        jobID = jobExecutionContext.getJobDetails().getJobID();
-        taskID = jobExecutionContext.getTaskData().getTaskID();
-        experimentID = jobExecutionContext.getExperiment().getExperimentID();
-        workflowNodeID =  jobExecutionContext.getWorkflowNodeDetails().getNodeInstanceId();//
at this point we only have one node todo: fix this
-
     }
 
     public HPCMonitorID(HostDescription host, String jobID,String taskID, String workflowNodeID,
String experimentID, String userName,AuthenticationInfo authenticationInfo) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/ee50805c/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
index 8f8325b..97546ba 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
@@ -21,11 +21,9 @@
 
 package org.apache.airavata.orchestrator.server;
 
-import java.util.Arrays;
 import java.util.Calendar;
 import java.util.List;
 
-import org.apache.airavata.model.error.LaunchValidationException;
 import org.apache.airavata.model.workspace.experiment.*;
 import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
 import org.apache.airavata.orchestrator.cpi.OrchestratorService;


Mime
View raw message