airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject git commit: fixing duplicate task status
Date Fri, 03 Oct 2014 19:19:35 GMT
Repository: airavata
Updated Branches:
  refs/heads/master cbfeb2c36 -> 2b0b6a272


fixing duplicate task status


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

Branch: refs/heads/master
Commit: 2b0b6a27200cce66cb2e15a89009407b48647f97
Parents: cbfeb2c
Author: Chathuri Wimalasena <kamalasini@gmail.com>
Authored: Fri Oct 3 15:19:20 2014 -0400
Committer: Chathuri Wimalasena <kamalasini@gmail.com>
Committed: Fri Oct 3 15:19:20 2014 -0400

----------------------------------------------------------------------
 .../airavata/client/samples/CreateLaunchExperiment.java | 12 ++++++------
 .../gfac/core/monitor/AiravataJobStatusUpdator.java     |  2 +-
 .../gfac/core/monitor/AiravataTaskStatusUpdator.java    |  8 ++++----
 .../jpa/resources/DataTransferDetailResource.java       |  2 ++
 .../registry/jpa/resources/ExperimentResource.java      |  2 ++
 .../registry/jpa/resources/JobDetailResource.java       |  2 ++
 .../registry/jpa/resources/TaskDetailResource.java      |  5 +++--
 .../jpa/resources/WorkflowNodeDetailResource.java       |  2 ++
 8 files changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/2b0b6a27/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index ad05d92..8d3ef3b 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
@@ -46,9 +46,9 @@ public class CreateLaunchExperiment {
     private static final String DEFAULT_USER = "default.registry.user";
     private static final String DEFAULT_GATEWAY = "default.registry.gateway";
     private static Airavata.Client airavataClient;
-    private static String echoAppId = "Echo_f99c94a4-a663-492e-bce6-266e77c06978";
-    private static String wrfAppId = "WRF_5f097c9c-7066-49ec-aed7-4e39607b3adc";
-    private static String amberAppId = "Amber_89906be6-5678-49a6-9d04-a0604fbdef2e";
+    private static String echoAppId = "Echo_89831769-edf5-4f27-a8c9-fe0ef96fd355";
+    private static String wrfAppId = "WRF_15ae6599-a48f-4134-95b8-98e109ac6f88";
+    private static String amberAppId = "Amber_a7b18a3a-31b3-4dc7-8faf-7c3144f14201";
 
     private static String localHost = "localhost";
     private static String trestlesHostName = "trestles.sdsc.xsede.org";
@@ -60,7 +60,7 @@ public class CreateLaunchExperiment {
                 airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST,
THRIFT_SERVER_PORT);
                 System.out.println("API version is " + airavataClient.getAPIVersion());
 //            registerApplications(); // run this only the first time
-                for (int i = 0; i < 100; i++) {
+//                for (int i = 0; i < 100; i++) {
 //            final String expId = createExperimentForSSHHost(airavata);
                     final String expId = createEchoExperimentForTrestles(airavataClient);
 //            final String expId = createEchoExperimentForStampede(airavataClient);
@@ -72,10 +72,10 @@ public class CreateLaunchExperiment {
 //            final String expId = createExperimentForStampedeAmber(airavataClient);
 //            final String expId = createExperimentForTrestlesAmber(airavataClient);
 
-//            System.out.println("Experiment ID : " + expId);
+            System.out.println("Experiment ID : " + expId);
 //            updateExperiment(airavata, expId);
                     launchExperiment(airavataClient, expId);
-                }
+//                }
             } catch (Exception e) {
                 logger.error("Error while connecting with server", e.getMessage());
                 e.printStackTrace();

http://git-wip-us.apache.org/repos/asf/airavata/blob/2b0b6a27/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 9d8cac9..7a09207 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
@@ -87,7 +87,7 @@ public class AiravataJobStatusUpdator implements AbstractActivityListener
{
         details.setJobStatus(status);
         details.setJobID(jobID);
         logger.debug("Updating job status for "+jobID+":"+details.getJobStatus().toString());
-        airavataRegistry.update(RegistryModelType.JOB_DETAIL, details, ids);
+        airavataRegistry.update(RegistryModelType.JOB_STATUS, status, ids);
     }
 
 	@SuppressWarnings("unchecked")

http://git-wip-us.apache.org/repos/asf/airavata/blob/2b0b6a27/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 1d22571..f7d8b28 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
@@ -99,8 +99,8 @@ public class AiravataTaskStatusUpdator implements AbstractActivityListener
{
     public  TaskState updateTaskStatus(String taskId, TaskState state) throws Exception {
     	TaskDetails details = (TaskDetails)airavataRegistry.get(RegistryModelType.TASK_DETAIL,
taskId);
         if(details == null) {
-            details = new TaskDetails();
-            details.setTaskID(taskId);
+            logger.error("Task details cannot be null at this point");
+            throw new Exception("Task details cannot be null at this point");
         }
         org.apache.airavata.model.workspace.experiment.TaskStatus status = new org.apache.airavata.model.workspace.experiment.TaskStatus();
         if(!TaskState.CANCELED.equals(details.getTaskStatus().getExecutionState())
@@ -113,8 +113,8 @@ public class AiravataTaskStatusUpdator implements AbstractActivityListener
{
         details.setTaskStatus(status);
         logger.debug("Updating task status for "+taskId+":"+details.getTaskStatus().toString());
 
-        airavataRegistry.update(RegistryModelType.TASK_DETAIL, details, taskId);
-        return details.getTaskStatus().getExecutionState();
+        airavataRegistry.update(RegistryModelType.TASK_STATUS, status, taskId);
+        return status.getExecutionState();
     }
 
 	public void setup(Object... configurations) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/2b0b6a27/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/DataTransferDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/DataTransferDetailResource.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/DataTransferDetailResource.java
index 442a38f..ab1b49e 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/DataTransferDetailResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/DataTransferDetailResource.java
@@ -103,6 +103,7 @@ public class DataTransferDetailResource extends AbstractResource {
                 case STATUS:
                     generator = new QueryGenerator(STATUS);
                     generator.setParameter(StatusConstants.TRANSFER_ID, name);
+                    generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.DATA_TRANSFER);
                     q = generator.deleteQuery(em);
                     q.executeUpdate();
                     break;
@@ -137,6 +138,7 @@ public class DataTransferDetailResource extends AbstractResource {
                 case STATUS:
                     generator = new QueryGenerator(STATUS);
                     generator.setParameter(StatusConstants.TRANSFER_ID, name);
+                    generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.DATA_TRANSFER);
                     q = generator.selectQuery(em);
                     Status status = (Status) q.getSingleResult();
                     StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS,
status);

http://git-wip-us.apache.org/repos/asf/airavata/blob/2b0b6a27/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
index bca77cd..3d06987 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
@@ -220,6 +220,7 @@ public class ExperimentResource extends AbstractResource {
                 case STATUS:
                     generator = new QueryGenerator(STATUS);
                     generator.setParameter(StatusConstants.EXPERIMENT_ID, name);
+                    generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.EXPERIMENT.toString());
                     q = generator.deleteQuery(em);
                     q.executeUpdate();
                     break;
@@ -325,6 +326,7 @@ public class ExperimentResource extends AbstractResource {
                 case STATUS:
                     generator = new QueryGenerator(STATUS);
                     generator.setParameter(StatusConstants.EXPERIMENT_ID, name);
+                    generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.EXPERIMENT.toString());
                     q = generator.selectQuery(em);
                     Status status = (Status) q.getSingleResult();
                     StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS,
status);

http://git-wip-us.apache.org/repos/asf/airavata/blob/2b0b6a27/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/JobDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/JobDetailResource.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/JobDetailResource.java
index 9dc3c20..ded0991 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/JobDetailResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/JobDetailResource.java
@@ -114,6 +114,7 @@ public class JobDetailResource extends AbstractResource {
                 case STATUS:
                     generator = new QueryGenerator(STATUS);
                     generator.setParameter(StatusConstants.JOB_ID, name);
+                    generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.JOB.toString());
                     q = generator.deleteQuery(em);
                     q.executeUpdate();
                     break;
@@ -154,6 +155,7 @@ public class JobDetailResource extends AbstractResource {
                 case STATUS:
                     generator = new QueryGenerator(STATUS);
                     generator.setParameter(StatusConstants.JOB_ID, name);
+                    generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.JOB.toString());
                     q = generator.selectQuery(em);
                     Status status = (Status) q.getSingleResult();
                     StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS,
status);

http://git-wip-us.apache.org/repos/asf/airavata/blob/2b0b6a27/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
index a66ab79..a49675f 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
@@ -26,11 +26,10 @@ import org.apache.airavata.persistance.registry.jpa.ResourceType;
 import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
 import org.apache.airavata.persistance.registry.jpa.model.*;
 import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.cpi.RegistryException;
 import org.apache.airavata.registry.cpi.utils.StatusType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.airavata.registry.cpi.RegistryException;
 
 import javax.persistence.EntityManager;
 import javax.persistence.Query;
@@ -179,6 +178,7 @@ public class TaskDetailResource extends AbstractResource {
                 case STATUS:
                     generator = new QueryGenerator(STATUS);
                     generator.setParameter(StatusConstants.TASK_ID, name);
+                    generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.TASK.toString());
                     q = generator.deleteQuery(em);
                     q.executeUpdate();
                     break;
@@ -283,6 +283,7 @@ public class TaskDetailResource extends AbstractResource {
                 case STATUS:
                     generator = new QueryGenerator(STATUS);
                     generator.setParameter(StatusConstants.TASK_ID, name);
+                    generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.TASK.toString());
                     q = generator.selectQuery(em);
                     Status status = (Status) q.getSingleResult();
                     StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS,
status);

http://git-wip-us.apache.org/repos/asf/airavata/blob/2b0b6a27/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
index 3d96f45..9d2869d 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
@@ -141,6 +141,7 @@ public class WorkflowNodeDetailResource extends AbstractResource {
                 case STATUS:
                     generator = new QueryGenerator(STATUS);
                     generator.setParameter(StatusConstants.NODE_INSTANCE_ID, name);
+                    generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.WORKFLOW_NODE.toString());
                     q = generator.deleteQuery(em);
                     q.executeUpdate();
                     break;
@@ -210,6 +211,7 @@ public class WorkflowNodeDetailResource extends AbstractResource {
                 case STATUS:
                     generator = new QueryGenerator(STATUS);
                     generator.setParameter(StatusConstants.NODE_INSTANCE_ID, name);
+                    generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.WORKFLOW_NODE.toString());
                     q = generator.selectQuery(em);
                     Status status = (Status) q.getSingleResult();
                     StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS,
status);


Mime
View raw message