airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject airavata git commit: Adding getJobDetails implementation based on new models.
Date Tue, 08 Sep 2015 13:23:41 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 07e93bec9 -> 3f890f968


Adding getJobDetails implementation based on new models.


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

Branch: refs/heads/master
Commit: 3f890f9681cbaf65bee9e6fab2328dc62f769084
Parents: 07e93be
Author: Suresh Marru <smarru@apache.org>
Authored: Tue Sep 8 09:23:34 2015 -0400
Committer: Suresh Marru <smarru@apache.org>
Committed: Tue Sep 8 09:23:34 2015 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   | 35 +++++++++-----------
 1 file changed, 15 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/3f890f96/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index ec39c2e..6089a10 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -49,6 +49,7 @@ import org.apache.airavata.model.experiment.*;
 import org.apache.airavata.model.job.JobModel;
 import org.apache.airavata.model.messaging.event.ExperimentStatusChangeEvent;
 import org.apache.airavata.model.messaging.event.MessageType;
+import org.apache.airavata.model.process.ProcessModel;
 import org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel;
 import org.apache.airavata.model.security.AuthzToken;
 import org.apache.airavata.model.status.ExperimentState;
@@ -63,6 +64,8 @@ import org.apache.airavata.registry.core.app.catalog.resources.*;
 import org.apache.airavata.registry.core.app.catalog.util.AppCatalogThriftConversion;
 import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
 import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.core.experiment.catalog.model.*;
+import org.apache.airavata.registry.core.experiment.catalog.model.Process;
 import org.apache.airavata.registry.cpi.*;
 import org.apache.airavata.registry.cpi.utils.Constants;
 import org.apache.thrift.TException;
@@ -1561,40 +1564,32 @@ public class AiravataServerHandler implements Airavata.Iface {
     @SecurityCheck
     public List<JobModel> getJobDetails(AuthzToken authzToken, String airavataExperimentId)
throws InvalidRequestException,
             ExperimentNotFoundException, AiravataClientException, AiravataSystemException,
AuthorizationException, TException {
-        List<JobModel> jobDetailsList = new ArrayList<JobModel>();
-	    // FIXME : fix this method with new data model.
-      /*  try {
+        try {
             experimentCatalog = RegistryFactory.getDefaultExpCatalog();
             if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)){
                 logger.error(airavataExperimentId, "Error while retrieving job details, experiment
{} doesn't exist.", airavataExperimentId);
                 throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId
+ " does not exist in the system..");
             }
-            List<Object> workflowNodes = experimentCatalog.get(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL,
Constants.FieldConstants.WorkflowNodeConstants.EXPERIMENT_ID, airavataExperimentId);
-            if (workflowNodes != null && !workflowNodes.isEmpty()){
-                for (Object wf : workflowNodes){
-                    String nodeInstanceId = ((WorkflowNodeDetails) wf).getNodeInstanceId();
-                    List<Object> taskDetails = experimentCatalog.get(ExperimentCatalogModelType.TASK_DETAIL,
Constants.FieldConstants.TaskDetailConstants.NODE_ID, nodeInstanceId);
-                    if (taskDetails != null && !taskDetails.isEmpty()){
-                        for (Object ts : taskDetails){
-                            String taskID = ((TaskDetails) ts).getTaskID();
-                            List<Object> jobDetails = experimentCatalog.get(ExperimentCatalogModelType.JOB_DETAIL,
Constants.FieldConstants.JobDetaisConstants.TASK_ID, taskID);
-                            if (jobDetails != null && !jobDetails.isEmpty()){
-                                for (Object job : jobDetails){
-                                    jobDetailsList.add((JobDetails) job);
-                                }
-                            }
-                        }
+            List<Object> processModels = experimentCatalog.get(ExperimentCatalogModelType.PROCESS,
Constants.FieldConstants.ProcessConstants.EXPERIMENT_ID, airavataExperimentId);
+            List<JobModel> jobList = new ArrayList<>();
+            if (processModels != null && !processModels.isEmpty()){
+                for (Object process : processModels) {
+                    String processId =  ((ProcessModel)process).getProcessId();
+                    List<Object> jobs = experimentCatalog.get(ExperimentCatalogModelType.JOB,
Constants.FieldConstants.JobConstants.PROCESS_ID, processId);
+                    for (Object jobObject : jobs) {
+                        jobList.add ((JobModel)jobObject);
                     }
                 }
             }
+
+            return jobList;
         } catch (Exception e) {
             logger.error(airavataExperimentId, "Error while retrieving the job details",
e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving the job details. More info : " +
e.getMessage());
             throw exception;
-        }*/
-        return jobDetailsList;
+        }
     }
 
 


Mime
View raw message