airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject git commit: fixing AIRAVATA-1353
Date Tue, 19 Aug 2014 17:01:30 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 9c1f44d04 -> 5a750b398


fixing AIRAVATA-1353


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

Branch: refs/heads/master
Commit: 5a750b398ecb675b2ca3ed41a5bf3a4dadeb9ee2
Parents: 9c1f44d
Author: Chathuri Wimalasena <kamalasini@gmail.com>
Authored: Tue Aug 19 13:01:23 2014 -0400
Committer: Chathuri Wimalasena <kamalasini@gmail.com>
Committed: Tue Aug 19 13:01:23 2014 -0400

----------------------------------------------------------------------
 .../samples/TestCreateLaunchExperiment.java     |  5 ++-
 .../registry/jpa/impl/ExperimentRegistry.java   | 44 ++++++++++++++++++--
 2 files changed, 43 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/5a750b39/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/TestCreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/TestCreateLaunchExperiment.java
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/TestCreateLaunchExperiment.java
index c191f91..b660097 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/TestCreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/TestCreateLaunchExperiment.java
@@ -69,9 +69,10 @@ public class TestCreateLaunchExperiment {
             Calendar cal2 = Calendar.getInstance();
             Long to = cal2.getTimeInMillis();
 
-            List<ExperimentSummary> experiments = searchExperimentsByDate(airavata,
"admin", from, to);
+            List<ExperimentSummary> experiments = getExperimentsForApplication(airavata,
"admin", "e");
             for (ExperimentSummary experimentSummary : experiments){
-                System.out.println(experimentSummary.getExperimentID());
+//                System.out.println(experimentSummary.getExperimentID());
+                System.out.println(experimentSummary.getApplicationId());
 //                System.out.println(experimentSummary.getExperimentStatus().getExperimentState().toString());
             }
 //            getAllComputeResources(airavata);

http://git-wip-us.apache.org/repos/asf/airavata/blob/5a750b39/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
index b8f7b0d..29de636 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
@@ -2648,6 +2648,8 @@ public class ExperimentRegistry {
                         fil.put(AbstractResource.ExperimentConstants.EXECUTION_USER, filters.get(field));
                     }else if (field.equals(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_DESC)){
                         fil.put(AbstractResource.ExperimentConstants.DESCRIPTION, filters.get(field));
+                    }else if (field.equals(Constants.FieldConstants.ExperimentConstants.APPLICATION_ID)){
+                        fil.put(AbstractResource.ExperimentConstants.APPLICATION_ID, filters.get(field));
                     }else if (field.equals(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_STATUS)){
                         return searchExperimentsByStatus(ExperimentState.valueOf(filters.get(field)));
                     }else if (field.equals(Constants.FieldConstants.ExperimentConstants.FROM_DATE)){
@@ -2659,10 +2661,14 @@ public class ExperimentRegistry {
                 if (fromTime != 0 && toTime != 0){
                     return searchExperimentsByCreationTime(new Timestamp(fromTime), new Timestamp(toTime));
                 }
-                List<ExperimentResource> experimentResources = workerResource.searchExperiments(fil);
-                if (experimentResources != null && !experimentResources.isEmpty()){
-                    for (ExperimentResource ex : experimentResources){
-                        experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
+                if (fil.containsKey(AbstractResource.ExperimentConstants.APPLICATION_ID)){
+                    return searchExperimentsByApplication(fil);
+                }else {
+                    List<ExperimentResource> experimentResources = workerResource.searchExperiments(fil);
+                    if (experimentResources != null && !experimentResources.isEmpty()){
+                        for (ExperimentResource ex : experimentResources){
+                            experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
+                        }
                     }
                 }
                 return experimentSummaries;
@@ -2692,6 +2698,36 @@ public class ExperimentRegistry {
         }
     }
 
+    public List<ExperimentSummary> searchExperimentsByApplication (Map<String, String>
fil) throws RegistryException {
+        try {
+            List<ExperimentSummary> experimentSummaries = new ArrayList<ExperimentSummary>();
+            List<ExperimentResource> experimentResources = workerResource.searchExperiments(fil);
+            if (experimentResources != null && !experimentResources.isEmpty()) {
+                for (ExperimentResource ex : experimentResources) {
+                    String applicationId = ex.getApplicationId();
+                    String[] splits = applicationId.split("_");
+                    if (splits.length != 0){
+                       for (int i = 0; i< splits.length -1; i++){
+                           String appId = fil.get(AbstractResource.ExperimentConstants.APPLICATION_ID);
+                           if (!appId.equals("*")){
+                               if (splits[i].contains(appId)){
+                                   experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
+                               }
+                           }else {
+                               experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
+                           }
+                       }
+                    }
+                }
+            }
+            return experimentSummaries;
+
+        } catch (Exception e) {
+            logger.error("Error while retrieving experiment summary from registry", e);
+            throw new RegistryException(e);
+        }
+    }
+
     public List<ExperimentSummary> searchExperimentsByCreationTime (Timestamp fromTime,
Timestamp toTime) throws RegistryException {
         try {
             List<ExperimentSummary> experimentSummaries = new ArrayList<ExperimentSummary>();


Mime
View raw message