airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject airavata git commit: fixing getExperimentStatistics issue in registry
Date Sun, 30 Aug 2015 13:58:36 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 1f065a3a4 -> 22d9b8293


fixing getExperimentStatistics issue in registry


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

Branch: refs/heads/master
Commit: 22d9b8293e7bd26490bfbe86c26708e56f605ee9
Parents: 1f065a3
Author: Supun Nakandala <scnakandala@apache.org>
Authored: Sun Aug 30 19:28:11 2015 +0530
Committer: Supun Nakandala <scnakandala@apache.org>
Committed: Sun Aug 30 19:28:11 2015 +0530

----------------------------------------------------------------------
 .../resources/ExperimentStatisticsResource.java | 38 +++++++++++++++++++-
 .../catalog/resources/WorkerResource.java       | 14 +++++++-
 2 files changed, 50 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/22d9b829/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentStatisticsResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentStatisticsResource.java
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentStatisticsResource.java
index 11cc510..593ef5b 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentStatisticsResource.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentStatisticsResource.java
@@ -34,10 +34,14 @@ public class ExperimentStatisticsResource extends AbstractExpCatResource
{
 
     private int allExperimentCount;
     private int completedExperimentCount;
+    private int createdExperimentCount;
+    private int runningExperimentCount;
     private int cancelledExperimentCount;
     private int failedExperimentCount;
 
     private List<ExperimentSummaryResource> allExperiments;
+    private List<ExperimentSummaryResource> createdExperiments;
+    private List<ExperimentSummaryResource> runningExperiments;
     private List<ExperimentSummaryResource> completedExperiments;
     private List<ExperimentSummaryResource> cancelledExperiments;
     private List<ExperimentSummaryResource> failedExperiments;
@@ -53,7 +57,7 @@ public class ExperimentStatisticsResource extends AbstractExpCatResource
{
     }
 
     @Override
-    public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException
{
+    public ExperimentResource get(ResourceType type, Object name) throws RegistryException
{
         throw new MethodNotFoundException();
     }
 
@@ -130,4 +134,36 @@ public class ExperimentStatisticsResource extends AbstractExpCatResource
{
     public void setFailedExperiments(List<ExperimentSummaryResource> failedExperiments)
{
         this.failedExperiments = failedExperiments;
     }
+
+    public int getCreatedExperimentCount() {
+        return createdExperimentCount;
+    }
+
+    public void setCreatedExperimentCount(int createdExperimentCount) {
+        this.createdExperimentCount = createdExperimentCount;
+    }
+
+    public int getRunningExperimentCount() {
+        return runningExperimentCount;
+    }
+
+    public void setRunningExperimentCount(int runningExperimentCount) {
+        this.runningExperimentCount = runningExperimentCount;
+    }
+
+    public List<ExperimentSummaryResource> getCreatedExperiments() {
+        return createdExperiments;
+    }
+
+    public void setCreatedExperiments(List<ExperimentSummaryResource> createdExperiments)
{
+        this.createdExperiments = createdExperiments;
+    }
+
+    public List<ExperimentSummaryResource> getRunningExperiments() {
+        return runningExperiments;
+    }
+
+    public void setRunningExperiments(List<ExperimentSummaryResource> runningExperiments)
{
+        this.runningExperiments = runningExperiments;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/22d9b829/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java
index 6fc1822..fe1b32b 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java
@@ -681,6 +681,17 @@ public class WorkerResource extends AbstractExpCatResource {
         experimentStatisticsResource.setAllExperimentCount(allExperiments.size());
         experimentStatisticsResource.setAllExperiments(allExperiments);
 
+        List<ExperimentSummaryResource> createdExperiments = getExperimentStatisticsForState(ExperimentState.CREATED,
gatewayId, fromTime, toTime);
+        createdExperiments.addAll(getExperimentStatisticsForState(ExperimentState.VALIDATED,
gatewayId, fromTime, toTime));
+        experimentStatisticsResource.setCreatedExperimentCount(createdExperiments.size());
+        experimentStatisticsResource.setCreatedExperiments(createdExperiments);
+
+        List<ExperimentSummaryResource> runningExperiments = getExperimentStatisticsForState(ExperimentState.EXECUTING,
gatewayId, fromTime, toTime);
+        runningExperiments.addAll(getExperimentStatisticsForState(ExperimentState.SCHEDULED,
gatewayId, fromTime, toTime));
+        runningExperiments.addAll(getExperimentStatisticsForState(ExperimentState.LAUNCHED,
gatewayId, fromTime, toTime));
+        experimentStatisticsResource.setRunningExperimentCount(runningExperiments.size());
+        experimentStatisticsResource.setRunningExperiments(runningExperiments);
+
         List<ExperimentSummaryResource> completedExperiments = getExperimentStatisticsForState(ExperimentState.COMPLETED,
gatewayId, fromTime, toTime);
         experimentStatisticsResource.setCompletedExperimentCount(completedExperiments.size());
         experimentStatisticsResource.setCompletedExperiments(completedExperiments);
@@ -690,6 +701,7 @@ public class WorkerResource extends AbstractExpCatResource {
         experimentStatisticsResource.setFailedExperiments(failedExperiments);
 
         List<ExperimentSummaryResource> cancelledExperiments = getExperimentStatisticsForState(ExperimentState.CANCELED,
gatewayId, fromTime, toTime);
+        cancelledExperiments.addAll(getExperimentStatisticsForState(ExperimentState.CANCELING,
gatewayId, fromTime, toTime));
         experimentStatisticsResource.setCancelledExperimentCount(cancelledExperiments.size());
         experimentStatisticsResource.setCancelledExperiments(cancelledExperiments);
 
@@ -702,7 +714,7 @@ public class WorkerResource extends AbstractExpCatResource {
         List<ExperimentSummaryResource> result = new ArrayList();
         try {
             String query = "SELECT e FROM ExperimentSummary e " +
-                    "WHERE e.expId=s.expId AND ";
+                    "WHERE ";
             if (expState != null) {
                 query += "e.state='" + expState.toString() + "' AND ";
             }


Mime
View raw message