airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject airavata git commit: fixing validation - AIRAVATA-1682
Date Wed, 22 Apr 2015 20:06:09 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 4a043bec6 -> 0f8269da3


fixing validation - AIRAVATA-1682


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

Branch: refs/heads/master
Commit: 0f8269da3961adfa2b85823a86b6a184192fb357
Parents: 4a043be
Author: Chathuri Wimalasena <kamalasini@gmail.com>
Authored: Wed Apr 22 16:06:03 2015 -0400
Committer: Chathuri Wimalasena <kamalasini@gmail.com>
Committed: Wed Apr 22 16:06:03 2015 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   |  4 +-
 .../tools/RegisterSampleApplications.java       | 53 +++++++++--
 .../core/validator/JobMetadataValidator.java    |  5 +-
 .../impl/ExperimentStatusValidator.java         | 22 +++--
 .../validator/impl/SimpleAppDataValidator.java  | 95 ++++++++++++++++++--
 .../cpi/impl/SimpleOrchestratorImpl.java        | 46 ++++++----
 .../orchestrator/core/util/SecondValidator.java | 11 ++-
 .../orchestrator/core/util/TestValidator.java   | 15 ++--
 .../test-suite/multi-tenanted-airavata/pom.xml  | 10 +--
 9 files changed, 203 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/0f8269da/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 00ad99f..e2b402e 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
@@ -1277,10 +1277,10 @@ public class AiravataServerHandler implements Airavata.Iface {
                 throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId
+ " does not exist in the system..");
             }
         } catch (RegistryException e1) {
-            logger.errorId(airavataExperimentId, "Error while retrieving projects", e1);
+            logger.errorId(airavataExperimentId, "Error while instantiate the registry instance",
e1);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
-            exception.setMessage("Error while retrieving projects. More info : " + e1.getMessage());
+            exception.setMessage("Error while instantiate the registry instance. More info
: " + e1.getMessage());
             throw exception;
         }
     	Experiment experiment = getExperiment(airavataExperimentId);

http://git-wip-us.apache.org/repos/asf/airavata/blob/0f8269da/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
index f90f633..ffdc584 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
@@ -200,26 +200,43 @@ public class RegisterSampleApplications {
             System.out.println("\n #### Registering XSEDE Computational Resources #### \n");
 
             //Register Stampede
+            List<BatchQueue> stampedeQueues = new ArrayList<>();
+            BatchQueue normalQueue = createBatchQueue("normal", "Normal Queue", 2880, 256,
4000, 50, 0);
+            BatchQueue developmentQueue = createBatchQueue("development", "Development Queue",
120, 16, 4000, 1, 0);
+            stampedeQueues.add(normalQueue);
+            stampedeQueues.add(developmentQueue);
             stampedeResourceId = registerComputeHost("stampede.tacc.xsede.org", "TACC Stampede
Cluster",
-                    ResourceJobManagerType.SLURM, "push", "/usr/bin", SecurityProtocol.SSH_KEYS,
22, null);
+                    ResourceJobManagerType.SLURM, "push", "/usr/bin", SecurityProtocol.SSH_KEYS,
22, null, stampedeQueues);
+
             System.out.println("Stampede Resource Id is " + stampedeResourceId);
 
             //Register Trestles
+            List<BatchQueue> trestlesQueues = new ArrayList<>();
+            BatchQueue normalQueue_tr = createBatchQueue("normal", "Normal Queue", 2880,
32, 32, 50, 0);
+            BatchQueue sharedQueue_tr = createBatchQueue("shared", "Shared Queue", 2880,
4, 32, 50, 0);
+            trestlesQueues.add(normalQueue_tr);
+            trestlesQueues.add(sharedQueue_tr);
             trestlesResourceId = registerComputeHost("trestles.sdsc.xsede.org", "SDSC Trestles
Cluster",
-                    ResourceJobManagerType.PBS, "push", "/opt/torque/bin/", SecurityProtocol.SSH_KEYS,
22, null);
+                    ResourceJobManagerType.PBS, "push", "/opt/torque/bin/", SecurityProtocol.SSH_KEYS,
22, null, trestlesQueues);
             System.out.println("Trestles Resource Id is " + trestlesResourceId);
 
             //Register BigRedII
+            List<BatchQueue> br2Queues = new ArrayList<>();
+            BatchQueue normalQueue_br2 = createBatchQueue("normal", "Normal Queue", 2880,
340, 2048, 50, 0);
+            BatchQueue serial_br2 = createBatchQueue("serial", "Normal Queue", 10080, 340,
2048, 50, 0);
+            br2Queues.add(normalQueue_br2);
+            br2Queues.add(serial_br2);
             bigredResourceId = registerComputeHost("bigred2.uits.iu.edu", "IU BigRed II Cluster",
-                    ResourceJobManagerType.PBS, "push", "/opt/torque/torque-4.2.3.1/bin/",
SecurityProtocol.SSH_KEYS, 22, "aprun -n");
+                    ResourceJobManagerType.PBS, "push", "/opt/torque/torque-4.2.3.1/bin/",
SecurityProtocol.SSH_KEYS, 22, "aprun -n", br2Queues);
             System.out.println("BigredII Resource Id is " + bigredResourceId);
 
             fsdResourceId = registerUnicoreEndpoint("fsd-cloud15.zam.kfa-juelich.de", "interop
host", JobSubmissionProtocol.UNICORE, SecurityProtocol.GSI);
             System.out.println("FSd Resource Id: "+fsdResourceId);
 
             //Register Alamo
+            List<BatchQueue> alamoQueues = new ArrayList<>();
             alamoResourceId = registerComputeHost("alamo.uthscsa.edu", "Alamo Cluster",
-                    ResourceJobManagerType.PBS, "push", "/usr/bin/", SecurityProtocol.SSH_KEYS,
22, "/usr/bin/mpiexec -np");
+                    ResourceJobManagerType.PBS, "push", "/usr/bin/", SecurityProtocol.SSH_KEYS,
22, "/usr/bin/mpiexec -np", alamoQueues);
             System.out.println("Alamo Cluster " + alamoResourceId);
             
 
@@ -234,8 +251,9 @@ public class RegisterSampleApplications {
             System.out.println("\n #### Registering Non-XSEDE Computational Resources ####
\n");
 
             //Register LSF resource
+            List<BatchQueue> lsfQueues = new ArrayList<>();
             lsfResourceId = registerComputeHost("ghpcc06.umassrc.org", "LSF Cluster",
-                    ResourceJobManagerType.LSF, "push", "source /etc/bashrc;/lsf/9.1/linux2.6-glibc2.3-x86_64/bin",
SecurityProtocol.SSH_KEYS, 22, "mpiexec");
+                    ResourceJobManagerType.LSF, "push", "source /etc/bashrc;/lsf/9.1/linux2.6-glibc2.3-x86_64/bin",
SecurityProtocol.SSH_KEYS, 22, "mpiexec", lsfQueues);
             System.out.println("LSF Resource Id is " + lsfResourceId);
 
         } catch (TException e) {
@@ -1307,16 +1325,35 @@ public class RegisterSampleApplications {
         }
     }
 
-    
+    public BatchQueue createBatchQueue (String queuename,
+                                        String queueDesc,
+                                        int maxRunTime,
+                                        int maxNodes,
+                                        int maxProcessors,
+                                        int maxJobsInQueue,
+                                        int maxMemory){
+        BatchQueue batchQueue = new BatchQueue();
+        batchQueue.setQueueName(queuename);
+        batchQueue.setQueueDescription(queueDesc);
+        batchQueue.setMaxMemory(maxMemory);
+        batchQueue.setMaxJobsInQueue(maxJobsInQueue);
+        batchQueue.setMaxNodes(maxNodes);
+        batchQueue.setMaxRunTime(maxRunTime);
+        batchQueue.setMaxProcessors(maxProcessors);
+        return batchQueue;
+    }
     
     public String registerComputeHost(String hostName, String hostDesc,
                                              ResourceJobManagerType resourceJobManagerType,
                                              String monitoringEndPoint, String jobMangerBinPath,
-                                             SecurityProtocol securityProtocol, int portNumber,
String jobManagerCommand) throws TException {
+                                             SecurityProtocol securityProtocol,
+                                             int portNumber,
+                                             String jobManagerCommand,
+                                             List<BatchQueue> batchQueues) throws TException
{
 
         ComputeResourceDescription computeResourceDescription = RegisterSampleApplicationsUtils.
                 createComputeResourceDescription(hostName, hostDesc, null, null);
-
+        computeResourceDescription.setBatchQueues(batchQueues);
         String computeResourceId = airavataClient.registerComputeResource(computeResourceDescription);
 
         if (computeResourceId.isEmpty()) throw new AiravataClientException();

http://git-wip-us.apache.org/repos/asf/airavata/blob/0f8269da/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/JobMetadataValidator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/JobMetadataValidator.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/JobMetadataValidator.java
index 0a8b46a..a564dae 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/JobMetadataValidator.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/JobMetadataValidator.java
@@ -20,11 +20,10 @@
 */
 package org.apache.airavata.orchestrator.core.validator;
 
-import org.apache.airavata.model.error.ValidatorResult;
+import org.apache.airavata.model.error.ValidationResults;
 import org.apache.airavata.model.workspace.experiment.Experiment;
 import org.apache.airavata.model.workspace.experiment.TaskDetails;
 import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
-import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
 
 /**
  * This is the interface to implement a validation logic, users can implement their validation
@@ -43,5 +42,5 @@ public interface JobMetadataValidator {
      * @param taskID
      * @return
      */
-    ValidatorResult validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail,
TaskDetails taskID);
+    ValidationResults validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail,
TaskDetails taskID);
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/0f8269da/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/ExperimentStatusValidator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/ExperimentStatusValidator.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/ExperimentStatusValidator.java
index 276a26f..98b7458 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/ExperimentStatusValidator.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/ExperimentStatusValidator.java
@@ -20,26 +20,38 @@
 */
 package org.apache.airavata.orchestrator.core.validator.impl;
 
+import org.apache.airavata.model.error.ValidationResults;
 import org.apache.airavata.model.error.ValidatorResult;
-import org.apache.airavata.model.workspace.experiment.*;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+import org.apache.airavata.model.workspace.experiment.TaskDetails;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
 import org.apache.airavata.orchestrator.core.validator.JobMetadataValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public class ExperimentStatusValidator implements JobMetadataValidator {
     private static Logger log = LoggerFactory.getLogger(ExperimentStatusValidator.class);
 
-    public ValidatorResult validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail,
TaskDetails taskID) {
+    public ValidationResults validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail,
TaskDetails taskID) {
         String error = "During the validation step experiment status should be CREATED, But
this experiment status is : ";
+        ValidationResults validationResults = new ValidationResults();
+        validationResults.setValidationState(true);
         ValidatorResult validatorResult = new ValidatorResult();
+        List<ValidatorResult> validatorResultList = new ArrayList<ValidatorResult>();
         if (!experiment.getExperimentStatus().getExperimentState().equals(ExperimentState.CREATED))
{
             error += experiment.getExperimentStatus().getExperimentState().toString();
             log.error(error);
             validatorResult.setErrorDetails(error);
-            validatorResult.setResult(false);;
-            return validatorResult;
+            validatorResult.setResult(false);
+            validationResults.setValidationState(false);
         }
         validatorResult.setResult(true);
-        return validatorResult;
+        validatorResultList.add(validatorResult);
+        validationResults.setValidationResultList(validatorResultList);
+        return validationResults;
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/0f8269da/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/SimpleAppDataValidator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/SimpleAppDataValidator.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/SimpleAppDataValidator.java
index 8847500..d3102b6 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/SimpleAppDataValidator.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/SimpleAppDataValidator.java
@@ -20,11 +20,14 @@
 */
 package org.apache.airavata.orchestrator.core.validator.impl;
 
+import org.airavata.appcatalog.cpi.AppCatalog;
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
+import org.apache.airavata.model.appcatalog.computeresource.BatchQueue;
+import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription;
+import org.apache.airavata.model.error.ValidationResults;
 import org.apache.airavata.model.error.ValidatorResult;
-import org.apache.airavata.model.workspace.experiment.Experiment;
-import org.apache.airavata.model.workspace.experiment.TaskDetails;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
-import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
+import org.apache.airavata.model.workspace.experiment.*;
 import org.apache.airavata.orchestrator.core.validator.JobMetadataValidator;
 import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
 import org.apache.airavata.registry.cpi.Registry;
@@ -32,24 +35,98 @@ import org.apache.airavata.registry.cpi.RegistryException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public class SimpleAppDataValidator implements JobMetadataValidator {
     private final static Logger logger = LoggerFactory.getLogger(SimpleAppDataValidator.class);
 
     private Registry registry;
+    private AppCatalog appCatalog;
 
     public SimpleAppDataValidator() {
         try {
             this.registry = RegistryFactory.getDefaultRegistry();
+            this.appCatalog = AppCatalogFactory.getAppCatalog();
         } catch (RegistryException e) {
             logger.error("Unable to initialize registry", e);
+        } catch (AppCatalogException e) {
+            logger.error("Unable to initialize Application Catalog", e);
+        }
+    }
+
+    public ValidationResults validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail,
TaskDetails taskID) {
+        ValidationResults validationResults = new ValidationResults();
+        validationResults.setValidationState(true);
+        try {
+            List<ValidatorResult> validatorResultList = validateUserConfiguration(experiment,
taskID);
+            for (ValidatorResult result : validatorResultList){
+                if (!result.isResult()){
+                    validationResults.setValidationState(false);
+                    break;
+                }
+            }
+            validationResults.setValidationResultList(validatorResultList);
+        } catch (AppCatalogException e) {
+            logger.error("Error while validating user configuration", e);
         }
+        return validationResults;
     }
 
-    public ValidatorResult validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail,
TaskDetails taskID) {
-        boolean result = false;
-        if (experiment.getUserConfigurationData().isAiravataAutoSchedule()) {
-            logger.error("We dont' support auto scheduling at this point, We will simply
use user data as it is");
+    private List<ValidatorResult> validateUserConfiguration (Experiment experiment,
TaskDetails taskDetail) throws AppCatalogException{
+        List<ValidatorResult> validatorResultList = new ArrayList<ValidatorResult>();
+        try {
+            UserConfigurationData userConfigurationData = experiment.getUserConfigurationData();
+            ComputationalResourceScheduling computationalResourceScheduling = userConfigurationData.getComputationalResourceScheduling();
+            if (userConfigurationData.isAiravataAutoSchedule()) {
+                logger.error("We dont' support auto scheduling at this point, We will simply
use user data as it is");
+                ValidatorResult validatorResult = new ValidatorResult();
+                validatorResult.setResult(false);
+                validatorResultList.add(validatorResult);
+            }
+            ComputeResourceDescription computeResource = appCatalog.getComputeResource().getComputeResource(taskDetail.getTaskScheduling().getResourceHostId());
+            List<BatchQueue> batchQueues = computeResource.getBatchQueues();
+
+            if (batchQueues != null && !batchQueues.isEmpty()){
+                if (computationalResourceScheduling != null){
+                    String queueName = computationalResourceScheduling.getQueueName();
+                    int wallTimeLimit = computationalResourceScheduling.getWallTimeLimit();
+                    ValidatorResult queueNameResult = new ValidatorResult();
+
+                    queueNameResult.setResult(false);
+                    queueNameResult.setErrorDetails("Unable to find queue name from appcatalog
configured queues.. Either you " +
+                            "specified a wrong queue name or you did not configure app catalog
correctly...");
+                    for (BatchQueue queue : batchQueues){
+                        String configuredQname = queue.getQueueName();
+                        int maxRunTime = queue.getMaxRunTime();
+                        if (configuredQname != null && configuredQname.equals(queueName)){
+                            ValidatorResult wallTimeResult = new ValidatorResult();
+                            wallTimeResult.setResult(false);
+                            wallTimeResult.setErrorDetails("Provided walltime period exceeds
max walltime configured..");
+                            queueNameResult.setResult(true);
+                            queueNameResult.setErrorDetails("");
+                            if (maxRunTime != 0 && maxRunTime > wallTimeLimit){
+                                wallTimeResult.setResult(true);
+                                wallTimeResult.setErrorDetails("");
+                            }
+                            validatorResultList.add(wallTimeResult);
+                        }
+                    }
+                    validatorResultList.add(queueNameResult);
+
+                }
+            } else {
+                // for some compute resources, you dnt need to specify queue names
+                ValidatorResult result = new ValidatorResult();
+                logger.info("There are not queues defined under the compute resource. Airavata
assumes this experiment " +
+                        "does not need a queue name...");
+                result.setResult(true);
+                validatorResultList.add(result);
+            }
+        } catch (AppCatalogException e) {
+            logger.error("Error while getting information from App catalog", e);
+            throw new AppCatalogException("Error while getting information from App catalog",
e);
         }
-        return new ValidatorResult(true);
+        return validatorResultList;
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/0f8269da/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
index ee059a9..af76591 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
@@ -30,11 +30,13 @@ import org.apache.airavata.orchestrator.core.job.JobSubmitter;
 import org.apache.airavata.orchestrator.core.validator.JobMetadataValidator;
 import org.apache.airavata.registry.cpi.ChildDataType;
 import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.cpi.RegistryException;
 import org.apache.airavata.registry.cpi.RegistryModelType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 
@@ -118,42 +120,52 @@ public class SimpleOrchestratorImpl extends AbstractOrchestrator{
     public ValidationResults validateExperiment(Experiment experiment, WorkflowNodeDetails
workflowNodeDetail, TaskDetails taskID) throws OrchestratorException,LaunchValidationException
{
         org.apache.airavata.model.error.ValidationResults validationResults = new org.apache.airavata.model.error.ValidationResults();
         validationResults.setValidationState(true); // initially making it to success, if
atleast one failed them simply mark it failed.
+        String errorMsg = "Validation Errors : ";
         if (this.orchestratorConfiguration.isEnableValidation()) {
             List<String> validatorClzzez = this.orchestratorContext.getOrchestratorConfiguration().getValidatorClasses();
-            ValidatorResult vResult = null;
             for (String validator : validatorClzzez) {
                 try {
                     Class<? extends JobMetadataValidator> vClass = Class.forName(validator.trim()).asSubclass(JobMetadataValidator.class);
                     JobMetadataValidator jobMetadataValidator = vClass.newInstance();
-                    vResult = jobMetadataValidator.validate(experiment, workflowNodeDetail,
taskID);
-                    if (vResult.isResult()) {
+                    validationResults = jobMetadataValidator.validate(experiment, workflowNodeDetail,
taskID);
+                    if (validationResults.isValidationState()) {
                         logger.info("Validation of " + validator + " is SUCCESSFUL");
                     } else {
-                        logger.error("Validation of " + validator + " is FAILED:[error]"
+ vResult.getErrorDetails());
-                        //todo we need to store this message to registry
+                        List<ValidatorResult> validationResultList = validationResults.getValidationResultList();
+                        for (ValidatorResult result : validationResultList){
+                            if (!result.isResult()){
+                                String validationError = result.getErrorDetails();
+                                if (validationError != null){
+                                    errorMsg += validationError + " ";
+                                }
+                            }
+                        }
+                        logger.error("Validation of " + validator + " for experiment Id "
+ experiment.getExperimentID() + " is FAILED:[error]. " + errorMsg);
                         validationResults.setValidationState(false);
-                        // we do not return immediately after the first failure
+                        try {
+                            ErrorDetails details = new ErrorDetails();
+                            details.setActualErrorMessage(errorMsg);
+                            details.setCorrectiveAction(CorrectiveAction.RETRY_SUBMISSION);
+                            details.setActionableGroup(ActionableGroup.GATEWAYS_ADMINS);
+                            details.setCreationTime(Calendar.getInstance().getTimeInMillis());
+                            details.setErrorCategory(ErrorCategory.APPLICATION_FAILURE);
+                            orchestratorContext.getNewRegistry().add(ChildDataType.ERROR_DETAIL,
details,
+                                    taskID.getTaskID());
+                        } catch (RegistryException e) {
+                            logger.error("Error while saving error details to registry",
e);
+                        }
+                        break;
                     }
                 } catch (ClassNotFoundException e) {
                     logger.error("Error loading the validation class: ", validator, e);
-                    vResult = new ValidatorResult();
-                    vResult.setResult(false);
-                    vResult.setErrorDetails("Error loading the validation class: " + e.getMessage());
                     validationResults.setValidationState(false);
                 } catch (InstantiationException e) {
                     logger.error("Error loading the validation class: ", validator, e);
-                    vResult = new ValidatorResult();
-                    vResult.setResult(false);
-                    vResult.setErrorDetails("Error loading the validation class: " + e.getMessage());
                     validationResults.setValidationState(false);
                 } catch (IllegalAccessException e) {
                     logger.error("Error loading the validation class: ", validator, e);
-                    vResult = new ValidatorResult();
-                    vResult.setResult(false);
-                    vResult.setErrorDetails("Error loading the validation class: " + e.getMessage());
                     validationResults.setValidationState(false);
                 }
-                validationResults.addToValidationResultList(vResult);
             }
         }
         if(validationResults.isValidationState()){
@@ -162,7 +174,7 @@ public class SimpleOrchestratorImpl extends AbstractOrchestrator{
             //atleast one validation has failed, so we throw an exception
             LaunchValidationException launchValidationException = new LaunchValidationException();
             launchValidationException.setValidationResult(validationResults);
-            launchValidationException.setErrorMessage("Validation failed refer the validationResults
list for detail error");
+            launchValidationException.setErrorMessage("Validation failed refer the validationResults
list for detail error. Validation errors : " + errorMsg);
             throw launchValidationException;
         }
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/0f8269da/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/SecondValidator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/SecondValidator.java
b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/SecondValidator.java
index f55e15d..578aa9c 100644
--- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/SecondValidator.java
+++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/SecondValidator.java
@@ -20,20 +20,23 @@
 */
 package org.apache.airavata.orchestrator.core.util;
 
+import org.apache.airavata.model.error.ValidationResults;
 import org.apache.airavata.model.error.ValidatorResult;
 import org.apache.airavata.model.workspace.experiment.Experiment;
 import org.apache.airavata.model.workspace.experiment.TaskDetails;
 import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
-import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
 import org.apache.airavata.orchestrator.core.validator.JobMetadataValidator;
 
 public class SecondValidator implements JobMetadataValidator {
-    public ValidatorResult validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail,
TaskDetails taskID) {
+    public ValidationResults validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail,
TaskDetails taskID) {
+        ValidationResults validationResults = new ValidationResults();
+        validationResults.setValidationState(true);
         if(taskID.getTaskID() == null) {
             ValidatorResult validatorResult = new ValidatorResult(false);
             validatorResult.setErrorDetails("No taskID is set, so Validation failed");
-            return validatorResult;
+            validationResults.addToValidationResultList(validatorResult);
+            validationResults.setValidationState(false);
         }
-        return new ValidatorResult(true);
+        return validationResults;
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/0f8269da/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/TestValidator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/TestValidator.java
b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/TestValidator.java
index 5845760..dd4310c 100644
--- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/TestValidator.java
+++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/TestValidator.java
@@ -20,6 +20,7 @@
 */
 package org.apache.airavata.orchestrator.core.util;
 
+import org.apache.airavata.model.error.ValidationResults;
 import org.apache.airavata.model.error.ValidatorResult;
 import org.apache.airavata.model.workspace.experiment.Experiment;
 import org.apache.airavata.model.workspace.experiment.TaskDetails;
@@ -32,18 +33,22 @@ import org.slf4j.LoggerFactory;
 public class TestValidator implements JobMetadataValidator {
     private final static Logger logger = LoggerFactory.getLogger(TestValidator.class);
 
-    public ValidatorResult validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail,
TaskDetails taskID) {
+    public ValidationResults validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail,
TaskDetails taskID) {
+        ValidationResults validationResults = new ValidationResults();
+        validationResults.setValidationState(true);
         if (experiment.getProjectID() == null) {
             logger.error("Project ID is not set");
             ValidatorResult validatorResult = new ValidatorResult(false);
             validatorResult.setErrorDetails("Project ID is not set");
-            return validatorResult;
+            validationResults.addToValidationResultList(validatorResult);
+            validationResults.setValidationState(false);
         } else if (experiment.getExperimentID() == null) {
             logger.error("This experiment is wrong, no experimentID set");
-             ValidatorResult validatorResult = new ValidatorResult(false);
+            ValidatorResult validatorResult = new ValidatorResult(false);
             validatorResult.setErrorDetails("This experiment is wrong, no experimentID set");
-            return validatorResult;
+            validationResults.addToValidationResultList(validatorResult);
+            validationResults.setValidationState(false);
         }
-        return new ValidatorResult(true);
+        return validationResults;
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/0f8269da/modules/test-suite/multi-tenanted-airavata/pom.xml
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/pom.xml b/modules/test-suite/multi-tenanted-airavata/pom.xml
index 7af2864..8e96e7f 100644
--- a/modules/test-suite/multi-tenanted-airavata/pom.xml
+++ b/modules/test-suite/multi-tenanted-airavata/pom.xml
@@ -79,11 +79,11 @@
             <artifactId>gson</artifactId>
             <version>2.3.1</version>
         </dependency>
-        <!--<dependency>-->
-            <!--<groupId>mysql</groupId>-->
-            <!--<artifactId>mysql-connector-java</artifactId>-->
-            <!--<version>5.1.35</version>-->
-        <!--</dependency>-->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>5.1.35</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.derby</groupId>
             <artifactId>derbyclient</artifactId>


Mime
View raw message