airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject airavata git commit: missing gateway id and add create process method at orchestrator
Date Mon, 06 Jul 2015 17:05:37 GMT
Repository: airavata
Updated Branches:
  refs/heads/master d4ec47ecd -> b5b522ba4


missing gateway id and add create process method at orchestrator


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

Branch: refs/heads/master
Commit: b5b522ba4fd07456863538dda35d4e7ce5bf50a2
Parents: d4ec47e
Author: Chathuri Wimalasena <chathuri@apache.org>
Authored: Mon Jul 6 13:05:32 2015 -0400
Committer: Chathuri Wimalasena <chathuri@apache.org>
Committed: Mon Jul 6 13:05:32 2015 -0400

----------------------------------------------------------------------
 .../client/samples/CreateLaunchExperiment.java  | 12 ++++-----
 .../cpi/impl/SimpleOrchestratorImpl.java        | 26 ++++++++++++++++++++
 .../server/OrchestratorServerHandler.java       |  9 +++----
 .../experiment/catalog/resources/Utils.java     |  1 +
 4 files changed, 37 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/b5b522ba/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index aec893b..c10a271 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
@@ -48,17 +48,17 @@ import java.util.*;
 public class CreateLaunchExperiment {
 
     //FIXME: Read from a config file
-    public static final String THRIFT_SERVER_HOST = "localhost";
+    public static final String THRIFT_SERVER_HOST = "gw56.iu.xsede.org";
     public static final int THRIFT_SERVER_PORT = 8930;
 //	public static final String THRIFT_SERVER_HOST = "gw111.iu.xsede.org";
 //	public static final int THRIFT_SERVER_PORT = 9930;
 
     private final static Logger logger = LoggerFactory.getLogger(CreateLaunchExperiment.class);
-    private static final String DEFAULT_USER = "default.registry.user";
-    public static final String DEFAULT_GATEWAY = "php_reference_gateway";
+    public static final String DEFAULT_USER = "default.registry.user";
+    public static final String DEFAULT_GATEWAY = "default";
     private static Airavata.Client airavataClient;
 
-    private static String echoAppId = "Echo_53fcb5cd-7eda-485e-a9bc-fcf7c84a2e26";
+    private static String echoAppId = "Echo_ce3f152e-7757-41ea-880d-cc868063fb1b";
     private static String mpiAppId = "HelloMPI_bfd56d58-6085-4b7f-89fc-646576830518";
     private static String wrfAppId = "WRF_7ad5da38-c08b-417c-a9ea-da9298839762";
     private static String amberAppId = "Amber_357ba0ea-038c-4f14-b5f3-16bab331031b";
@@ -165,9 +165,9 @@ public class CreateLaunchExperiment {
 //                final String expId = createExperimentForSSHHost(airavata);
 //                final String expId = createEchoExperimentForFSD(airavataClient);
 //                final String expId = createMPIExperimentForFSD(airavataClient);
-//               final String expId = createEchoExperimentForStampede(airavataClient);
+               final String expId = createEchoExperimentForStampede(airavataClient);
 //                final String expId = createEchoExperimentForTrestles(airavataClient);
-                final String expId = createExperimentEchoForLocalHost(airavataClient);
+//                final String expId = createExperimentEchoForLocalHost(airavataClient);
 //                final String expId = createExperimentWRFTrestles(airavataClient);
 //                final String expId = createExperimentForBR2(airavataClient);
 //                final String expId = createExperimentForBR2Amber(airavataClient);

http://git-wip-us.apache.org/repos/asf/airavata/blob/b5b522ba/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 023c779..eba8320 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
@@ -26,14 +26,17 @@ import org.apache.airavata.model.error.ValidationResults;
 import org.apache.airavata.model.error.ValidatorResult;
 import org.apache.airavata.model.process.ProcessModel;
 import org.apache.airavata.model.experiment.*;
+import org.apache.airavata.model.util.ExperimentModelUtil;
 import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
 import org.apache.airavata.orchestrator.core.impl.GFACPassiveJobSubmitter;
 import org.apache.airavata.orchestrator.core.job.JobSubmitter;
 import org.apache.airavata.orchestrator.core.validator.JobMetadataValidator;
 import org.apache.airavata.registry.cpi.*;
+import org.apache.airavata.registry.cpi.utils.Constants;
 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;
@@ -169,4 +172,27 @@ public class SimpleOrchestratorImpl extends AbstractOrchestrator{
 
     }
 
+    public List<ProcessModel> createProcesses (String experimentId) throws OrchestratorException
{
+        List<ProcessModel> processModels = new ArrayList<ProcessModel>();
+        try {
+            Registry registry = orchestratorContext.getRegistry();
+            ExperimentModel experimentModel = (ExperimentModel)registry.getExperimentCatalog().get(ExperimentCatalogModelType.EXPERIMENT,
experimentId);
+            List<Object> processList = registry.getExperimentCatalog().get(ExperimentCatalogModelType.PROCESS,
Constants.FieldConstants.ExperimentConstants.EXPERIMENT_ID, experimentId);
+            if (processList != null && !processList.isEmpty()) {
+                for (Object processObject : processList) {
+                    ProcessModel processModel = (ProcessModel)processObject;
+                    processModels.add(processModel);
+                }
+            }else {
+                ProcessModel processModel = ExperimentModelUtil.cloneProcessFromExperiment(experimentModel);
+                String processId = (String)registry.getExperimentCatalog().add(ExpCatChildDataType.PROCESS,
processModel, experimentId);
+                processModel.setProcessId(processId);
+                processModels.add(processModel);
+            }
+        } catch (Exception e) {
+            throw new OrchestratorException("Error during creating process");
+        }
+        return processModels;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/b5b522ba/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 c0d63d6..f363f73 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
@@ -166,12 +166,11 @@ 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);
-			List<String> ids = experimentCatalog.getIds(ExperimentCatalogModelType.PROCESS,AbstractExpCatResource.ProcessConstants.EXPERIMENT_ID,
experimentId);
-			if (ids != null && !ids.isEmpty()){
-                for (String processId : ids) {
-                    ProcessModel processModel = (ProcessModel) experimentCatalog.get(ExperimentCatalogModelType.PROCESS,processId);
-                    return orchestrator.validateExperiment(experimentModel,processModel).isSetValidationState();
+			if (processes != null && !processes.isEmpty()){
+                for (ProcessModel process : processes) {
+                    return orchestrator.validateExperiment(experimentModel,process).isSetValidationState();
                 }
             }
 		} catch (OrchestratorException e) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/b5b522ba/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
index 511709a..b5a091a 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
@@ -414,6 +414,7 @@ public class Utils {
         if (o != null){
             experimentResource.setExperimentId(o.getExperimentId());
             experimentResource.setProjectId(o.getProjectId());
+            experimentResource.setGatewayId(o.getGatewayId());
             experimentResource.setExperimentType(o.getExperimentType());
             experimentResource.setUserName(o.getUserName());
             experimentResource.setExperimentName(o.getExperimentName());


Mime
View raw message