airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject [1/3] airavata git commit: generated thrift classes for tasks and orchestrator
Date Mon, 12 Oct 2015 16:10:14 GMT
Repository: airavata
Updated Branches:
  refs/heads/orchestratorTaskBreakdown 6b06c4ed3 -> 629306941


http://git-wip-us.apache.org/repos/asf/airavata/blob/62930694/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
b/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
index 4e8004b..7d158fd 100644
--- a/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
+++ b/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
@@ -137,11 +137,17 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface
{
 	public boolean launchExperiment(String experimentId, String gatewayId) throws TException
{
         ExperimentModel experiment = null;
         try {
+            List<ProcessModel> processes = orchestrator.createProcesses(experimentId);
             experiment = (ExperimentModel) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT,
experimentId);
             if (experiment == null) {
                 log.error(experimentId, "Error retrieving the Experiment by the given experimentID:
{} ", experimentId);
                 return false;
             }
+
+            if (!validateProcess(experimentId, processes)) {
+                log.error("Validating process fails for given experiment Id : {}", experimentId);
+                return false;
+            }
             ComputeResourcePreference computeResourcePreference = appCatalog.getGatewayProfile().getComputeResourcePreference(gatewayId,
experiment.getUserConfigurationData().getComputationalResourceScheduling().getResourceHostId());
             String token = computeResourcePreference.getResourceSpecificCredentialStoreToken();
             if (token == null || token.isEmpty()){
@@ -196,13 +202,8 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface
{
 	 */
 	public boolean validateExperiment(String experimentId) throws TException, LaunchValidationException
{
 		try {
-            List<ProcessModel> processes = orchestrator.createProcesses(experimentId);
             ExperimentModel experimentModel = (ExperimentModel)experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT,
experimentId);
-			if (processes != null && !processes.isEmpty()){
-                for (ProcessModel process : processes) {
-                    return orchestrator.validateExperiment(experimentModel,process).isSetValidationState();
-                }
-            }
+            return orchestrator.validateExperiment(experimentModel).isValidationState();
 		} catch (OrchestratorException e) {
             log.error(experimentId, "Error while validating experiment", e);
 			throw new TException(e);
@@ -210,9 +211,28 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface
{
             log.error(experimentId, "Error while validating experiment", e);
 			throw new TException(e);
 		}
-		return false;
 	}
 
+    @Override
+    public boolean validateProcess(String experimentId, List<ProcessModel> processes)
throws LaunchValidationException, TException {
+        try {
+            ExperimentModel experimentModel = (ExperimentModel)experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT,
experimentId);
+            for (ProcessModel processModel : processes){
+                boolean state = orchestrator.validateProcess(experimentModel, processModel).isSetValidationState();
+                if (!state){
+                    return false;
+                }
+            }
+            return true;
+        } catch (OrchestratorException e) {
+            log.error(experimentId, "Error while validating process", e);
+            throw new TException(e);
+        } catch (RegistryException e) {
+            log.error(experimentId, "Error while validating process", e);
+            throw new TException(e);
+        }
+    }
+
     /**
 	 * This can be used to cancel a running experiment and store the status to
 	 * terminated in registry

http://git-wip-us.apache.org/repos/asf/airavata/blob/62930694/thrift-interface-descriptions/orchestrator-cpi/orchestrator.cpi.service.thrift
----------------------------------------------------------------------
diff --git a/thrift-interface-descriptions/orchestrator-cpi/orchestrator.cpi.service.thrift
b/thrift-interface-descriptions/orchestrator-cpi/orchestrator.cpi.service.thrift
index 257f391..94ccec9 100644
--- a/thrift-interface-descriptions/orchestrator-cpi/orchestrator.cpi.service.thrift
+++ b/thrift-interface-descriptions/orchestrator-cpi/orchestrator.cpi.service.thrift
@@ -24,6 +24,7 @@
 */
 
 include "../airavata-api/airavata_errors.thrift"
+include "../airavata-api/process_model.thrift"
 namespace java org.apache.airavata.orchestrator.cpi
 
 const string ORCHESTRATOR_CPI_VERSION = "0.16.0"
@@ -64,8 +65,9 @@ service OrchestratorService {
      * @return sucess/failure
      *
     **/
-  bool validateExperiment(1: required string experimentId)
-  throws (1: airavata_errors.LaunchValidationException lve)
+  bool validateExperiment(1: required string experimentId) throws (1: airavata_errors.LaunchValidationException
lve)
+
+  bool validateProcess(1: required string experimentId, 2: required list<process_model.ProcessModel>
processes) throws (1: airavata_errors.LaunchValidationException lve)
     /**
      *
      * Terminate the running experiment.


Mime
View raw message