airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [6/6] airavata git commit: adding getDetailedExperimentTree method
Date Mon, 16 Nov 2015 16:38:51 GMT
adding getDetailedExperimentTree method


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

Branch: refs/heads/master
Commit: ee330724ff94bc6d2e197729637c5535af8081e7
Parents: dd32d06
Author: scnakandala <supun.nakandala@gmail.com>
Authored: Mon Nov 16 11:36:46 2015 -0500
Committer: scnakandala <supun.nakandala@gmail.com>
Committed: Mon Nov 16 11:38:27 2015 -0500

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   |    68 +-
 .../java/org/apache/airavata/api/Airavata.java  | 10779 ++++++++++-------
 .../main/resources/lib/airavata/Airavata.cpp    |   451 +
 .../src/main/resources/lib/airavata/Airavata.h  |   257 +-
 .../lib/airavata/Airavata_server.skeleton.cpp   |    42 +
 .../lib/airavata/experiment_model_types.cpp     |   380 +-
 .../lib/airavata/experiment_model_types.h       |    15 +-
 .../lib/airavata/process_model_types.cpp        |     4 +-
 .../lib/airavata/process_model_types.h          |     4 +-
 .../resources/lib/airavata/task_model_types.cpp |   204 +-
 .../resources/lib/airavata/task_model_types.h   |    15 +-
 .../resources/lib/Airavata/API/Airavata.php     |   433 +
 .../lib/Airavata/Model/Experiment/Types.php     |   187 +-
 .../resources/lib/Airavata/Model/Task/Types.php |    51 +
 .../lib/apache/airavata/api/Airavata-remote     |     7 +
 .../lib/apache/airavata/api/Airavata.py         |   358 +
 .../apache/airavata/model/experiment/ttypes.py  |   125 +-
 .../lib/apache/airavata/model/task/ttypes.py    |    25 +-
 .../org/apache/airavata/model/Workflow.java     |     2 +-
 .../ApplicationDeploymentDescription.java       |     2 +-
 .../appdeployment/ApplicationModule.java        |     2 +-
 .../appcatalog/appdeployment/CommandObject.java |     2 +-
 .../appcatalog/appdeployment/SetEnvPaths.java   |     2 +-
 .../ApplicationInterfaceDescription.java        |     2 +-
 .../appcatalog/computeresource/BatchQueue.java  |     2 +-
 .../computeresource/CloudJobSubmission.java     |     2 +-
 .../ComputeResourceDescription.java             |     2 +-
 .../computeresource/DataMovementInterface.java  |     2 +-
 .../computeresource/GlobusJobSubmission.java    |     2 +-
 .../computeresource/GridFTPDataMovement.java    |     2 +-
 .../computeresource/JobSubmissionInterface.java |     2 +-
 .../computeresource/LOCALDataMovement.java      |     2 +-
 .../computeresource/LOCALSubmission.java        |     2 +-
 .../computeresource/ResourceJobManager.java     |     2 +-
 .../computeresource/SCPDataMovement.java        |     2 +-
 .../computeresource/SSHJobSubmission.java       |     2 +-
 .../computeresource/UnicoreDataMovement.java    |     2 +-
 .../computeresource/UnicoreJobSubmission.java   |     2 +-
 .../ComputeResourcePreference.java              |     2 +-
 .../gatewayprofile/DataStoragePreference.java   |     2 +-
 .../gatewayprofile/GatewayResourceProfile.java  |     2 +-
 .../application/io/InputDataObjectType.java     |     2 +-
 .../application/io/OutputDataObjectType.java    |     2 +-
 .../airavata/model/commons/ErrorModel.java      |     2 +-
 .../model/commons/ValidationResults.java        |     2 +-
 .../airavata/model/commons/ValidatorResult.java |     2 +-
 .../model/error/AiravataClientException.java    |     2 +-
 .../model/error/AiravataSystemException.java    |     2 +-
 .../model/error/AuthenticationException.java    |     2 +-
 .../model/error/AuthorizationException.java     |     2 +-
 .../error/ExperimentNotFoundException.java      |     2 +-
 .../model/error/InvalidRequestException.java    |     2 +-
 .../model/error/LaunchValidationException.java  |     2 +-
 .../model/error/ProjectNotFoundException.java   |     2 +-
 .../airavata/model/error/TimedOutException.java |     2 +-
 .../airavata/model/error/ValidationResults.java |     2 +-
 .../airavata/model/error/ValidatorResult.java   |     2 +-
 .../model/experiment/ExperimentModel.java       |   256 +-
 .../model/experiment/ExperimentStatistics.java  |   218 +-
 .../experiment/ExperimentSummaryModel.java      |     2 +-
 .../experiment/UserConfigurationDataModel.java  |     2 +-
 .../org/apache/airavata/model/job/JobModel.java |     2 +-
 .../event/ExperimentStatusChangeEvent.java      |     2 +-
 .../model/messaging/event/JobIdentifier.java    |     2 +-
 .../messaging/event/JobStatusChangeEvent.java   |     2 +-
 .../event/JobStatusChangeRequestEvent.java      |     2 +-
 .../airavata/model/messaging/event/Message.java |     2 +-
 .../messaging/event/ProcessIdentifier.java      |     2 +-
 .../event/ProcessStatusChangeEvent.java         |     2 +-
 .../event/ProcessStatusChangeRequestEvent.java  |     2 +-
 .../messaging/event/ProcessSubmitEvent.java     |     2 +-
 .../messaging/event/ProcessTerminateEvent.java  |     2 +-
 .../model/messaging/event/TaskIdentifier.java   |     2 +-
 .../messaging/event/TaskOutputChangeEvent.java  |     2 +-
 .../messaging/event/TaskStatusChangeEvent.java  |     2 +-
 .../event/TaskStatusChangeRequestEvent.java     |     2 +-
 .../airavata/model/process/ProcessModel.java    |     2 +-
 .../ComputationalResourceSchedulingModel.java   |     2 +-
 .../airavata/model/security/AuthzToken.java     |     2 +-
 .../airavata/model/status/ExperimentStatus.java |     2 +-
 .../apache/airavata/model/status/JobStatus.java |     2 +-
 .../airavata/model/status/ProcessStatus.java    |     2 +-
 .../airavata/model/status/TaskStatus.java       |     2 +-
 .../model/task/DataStagingTaskModel.java        |     2 +-
 .../model/task/EnvironmentSetupTaskModel.java   |     2 +-
 .../model/task/JobSubmissionTaskModel.java      |     2 +-
 .../airavata/model/task/MonitorTaskModel.java   |     2 +-
 .../apache/airavata/model/task/TaskModel.java   |   170 +-
 .../airavata/model/workspace/Gateway.java       |     2 +-
 .../apache/airavata/model/workspace/Group.java  |     2 +-
 .../airavata/model/workspace/Project.java       |     2 +-
 .../apache/airavata/model/workspace/User.java   |     2 +-
 .../airavata-api/airavata_api.thrift            |    44 +
 .../airavata-api/experiment_model.thrift        |     4 +-
 .../airavata-api/task_model.thrift              |     4 +-
 95 files changed, 9008 insertions(+), 5235 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/ee330724/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 9f0e7cc..e88d4f8 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
@@ -74,10 +74,7 @@ import org.apache.thrift.TException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 public class AiravataServerHandler implements Airavata.Iface {
     private static final Logger logger = LoggerFactory.getLogger(AiravataServerHandler.class);
@@ -1255,6 +1252,69 @@ public class AiravataServerHandler implements Airavata.Iface {
         return getExperimentInternal(airavataExperimentId);
     }
 
+    /**
+     * Fetch the completed nested tree structue of previously created experiment metadata
which includes processes ->
+     * tasks -> jobs information.
+     *
+     * @param airavataExperimentId The identifier for the requested experiment. This is returned
during the create experiment step.
+     * @return experimentMetada
+     * This method will return the previously stored experiment metadata.
+     * @throws org.apache.airavata.model.error.InvalidRequestException     For any incorrect
forming of the request itself.
+     * @throws org.apache.airavata.model.error.ExperimentNotFoundException If the specified
experiment is not previously created, then an Experiment Not Found Exception is thrown.
+     * @throws org.apache.airavata.model.error.AiravataClientException     The following
list of exceptions are thrown which Airavata Client can take corrective actions to resolve:
+     *                                                                   <p/>
+     *                                                                   UNKNOWN_GATEWAY_ID
- If a Gateway is not registered with Airavata as a one time administrative
+     *                                                                   step, then Airavata
Registry will not have a provenance area setup. The client has to follow
+     *                                                                   gateway registration
steps and retry this request.
+     *                                                                   <p/>
+     *                                                                   AUTHENTICATION_FAILURE
- How Authentication will be implemented is yet to be determined.
+     *                                                                   For now this is
a place holder.
+     *                                                                   <p/>
+     *                                                                   INVALID_AUTHORIZATION
- This will throw an authorization exception. When a more robust security hand-shake
+     *                                                                   is implemented,
the authorization will be more substantial.
+     * @throws org.apache.airavata.model.error.AiravataSystemException     This exception
will be thrown for any Airavata Server side issues and if the problem cannot be corrected
by the client
+     *                                                                   rather an Airavata
Administrator will be notified to take corrective action.
+     */
+    @Override
+    @SecurityCheck
+    public ExperimentModel getDetailedExperimentTree(AuthzToken authzToken, String airavataExperimentId)
throws InvalidRequestException,
+            ExperimentNotFoundException, AiravataClientException, AiravataSystemException,
AuthorizationException, TException {
+        try {
+            ExperimentModel experimentModel =  getExperimentInternal(airavataExperimentId);
+            experimentCatalog = RegistryFactory.getDefaultExpCatalog();
+            List<Object> processObjects  = experimentCatalog.get(ExperimentCatalogModelType.PROCESS,
+                    Constants.FieldConstants.ExperimentConstants.EXPERIMENT_ID, experimentModel.getExperimentId());
+            List<ProcessModel> processList = new ArrayList<>();
+            if(processObjects != null){
+                processObjects.stream().forEach(p -> {
+                    //Process already has the task object
+                    ((ProcessModel)p).getTasks().stream().forEach(t->{
+                        try {
+                            List<Object> jobObjects = experimentCatalog.get(ExperimentCatalogModelType.JOB,
+                                    Constants.FieldConstants.JobConstants.TASK_ID, ((TaskModel)t).getTaskId());
+                            List<JobModel> jobList  = new ArrayList<JobModel>();
+                            if(jobObjects != null){
+                                jobObjects.stream().forEach(j -> jobList.add((JobModel)j));
+                                t.setJobs(jobList);
+                            }
+                        } catch (RegistryException e) {
+                            logger.error(e.getMessage(), e);
+                        }
+                    });
+                    processList.add((ProcessModel)p);
+                });
+                experimentModel.setProcesses(processList);
+            }
+            return experimentModel;
+        } catch (Exception e) {
+            logger.error("Error while retrieving the experiment", e);
+            AiravataSystemException exception = new AiravataSystemException();
+            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+            exception.setMessage("Error while retrieving the experiment. More info : " +
e.getMessage());
+            throw exception;
+        }
+    }
+
     /*This private method wraps the logic of getExperiment method as this method is called
internally in the API.*/
     private ExperimentModel getExperimentInternal(String airavataExperimentId) throws InvalidRequestException,
             ExperimentNotFoundException, AiravataClientException, AiravataSystemException,
TException {


Mime
View raw message