You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/06/27 17:32:26 UTC
[1/2] git commit: https://issues.apache.org/jira/browse/AIRAVATA-1301
+ introducing integration tests
Repository: airavata
Updated Branches:
refs/heads/master 37df1e0a6 -> f0aae9f17
https://issues.apache.org/jira/browse/AIRAVATA-1301 + introducing integration tests
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/e31265cb
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/e31265cb
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/e31265cb
Branch: refs/heads/master
Commit: e31265cba96b26fafcd855e7f8aacdf8011b8573
Parents: bed0745
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Fri Jun 27 11:31:54 2014 -0400
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Fri Jun 27 11:31:54 2014 -0400
----------------------------------------------------------------------
.../api/server/AiravataDerbyServer.java | 168 +++++
.../server/handler/AiravataServerHandler.java | 102 ++-
.../api/server/util/RegistryInitUtil.java | 14 +-
.../credential-store/pom.xml | 2 +-
.../airavata/gfac/core/cpi/BetterGfacImpl.java | 43 +-
modules/integration-tests/pom.xml | 2 +-
.../airavata/integration/DataRetrievalIT.java | 3 +-
.../server/OrchestratorServerHandler.java | 674 ++++++++++++-------
.../cpi/impl/SimpleOrchestratorImpl.java | 7 +-
.../registry/jpa/impl/ExperimentRegistry.java | 56 +-
.../registry/jpa/model/TaskDetail.java | 21 +
.../jpa/resources/TaskDetailResource.java | 55 +-
.../registry/jpa/resources/Utils.java | 2 +
.../jpa/utils/ThriftDataModelConversion.java | 2 +
.../src/main/resources/registry-derby.sql | 2 +
.../src/main/resources/registry-mysql.sql | 2 +
.../org/apache/airavata/server/ServerMain.java | 30 +-
pom.xml | 1 +
18 files changed, 864 insertions(+), 322 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataDerbyServer.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataDerbyServer.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataDerbyServer.java
new file mode 100644
index 0000000..3c54d2c
--- /dev/null
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataDerbyServer.java
@@ -0,0 +1,168 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.api.server;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.URI;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.IServer;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.model.error.AiravataSystemException;
+import org.apache.derby.drda.NetworkServerControl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AiravataDerbyServer implements IServer{
+
+ private final static Logger logger = LoggerFactory.getLogger(AiravataDerbyServer.class);
+ private static final String SERVER_NAME = "Airavata Derby Server";
+ private static final String SERVER_VERSION = "1.0";
+
+ public static final String CONFIGURATION_TABLE = "CONFIGURATION";
+ public static final String REGISTRY_JDBC_DRIVER = "registry.jdbc.driver";
+ public static final String REGISTRY_JDBC_URL = "registry.jdbc.url";
+ public static final String REGISTRY_JDBC_USER = "registry.jdbc.user";
+ public static final String REGISTRY_JDBC_PASSWORD = "registry.jdbc.password";
+ public static final String START_DERBY_ENABLE = "start.derby.server.mode";
+ public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
+ public static final String DEFAULT_PROJECT_NAME = "default";
+ private NetworkServerControl server;
+ private String jdbcURl;
+ private String jdbcUser;
+ private String jdbcPassword;
+
+ private ServerStatus status;
+
+ public AiravataDerbyServer() {
+ setStatus(ServerStatus.STOPPED);
+ }
+ public static int getPort(String jdbcURL){
+ try{
+ String cleanURI = jdbcURL.substring(5);
+ URI uri = URI.create(cleanURI);
+ return uri.getPort();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return -1;
+ }
+ }
+
+ public void startDerbyInServerMode() {
+ try {
+ System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
+ server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
+ getPort(jdbcURl),
+ jdbcUser, jdbcPassword);
+ java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
+ server.start(consoleWriter);
+ } catch (IOException e) {
+ logger.error("Unable to start Apache derby in the server mode! Check whether " +
+ "specified port is available");
+ } catch (Exception e) {
+ logger.error("Unable to start Apache derby in the server mode! Check whether " +
+ "specified port is available");
+ }
+ }
+
+ public void stopDerbyInServerMode() {
+ System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "false");
+ if (server!=null){
+ try {
+ server.shutdown();
+ } catch (Exception e) {
+ logger.error("Error when stopping the derby server : "+e.getLocalizedMessage());
+ }
+ }
+ }
+
+ public void startDerbyServer() throws AiravataSystemException {
+ AiravataUtils.setExecutionAsServer();
+ startDerbyServer();
+ setStatus(ServerStatus.STARTED);
+ }
+
+ public static void main(String[] args) {
+ try {
+ AiravataDerbyServer server = new AiravataDerbyServer();
+ server.start();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void start() throws Exception {
+ setStatus(ServerStatus.STARTING);
+ startDerbyServer();
+ }
+
+ @Override
+ public void stop() throws Exception {
+ if (getStatus()==ServerStatus.STARTED){
+ setStatus(ServerStatus.STOPING);
+ stopDerbyInServerMode();
+ setStatus(ServerStatus.STOPPED);
+ }
+ }
+
+ @Override
+ public void restart() throws Exception {
+ stop();
+ start();
+ }
+
+ @Override
+ public void configure() throws Exception {
+ try{
+ jdbcURl = ServerSettings.getSetting(REGISTRY_JDBC_URL);
+ jdbcUser = ServerSettings.getSetting(REGISTRY_JDBC_USER);
+ jdbcPassword = ServerSettings.getSetting(REGISTRY_JDBC_PASSWORD);
+ jdbcURl = jdbcURl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to read airavata server properties", e.getMessage());
+ }
+ }
+
+ @Override
+ public ServerStatus getStatus() throws Exception {
+ return status;
+ }
+
+ private void setStatus(ServerStatus stat){
+ status=stat;
+ status.updateTime();
+ }
+
+ @Override
+ public String getName() {
+ return SERVER_NAME;
+ }
+
+ @Override
+ public String getVersion() {
+ return SERVER_VERSION;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/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 a8f4297..fce8de2 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
@@ -21,37 +21,68 @@
package org.apache.airavata.api.server.handler;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
import org.apache.airavata.api.Airavata;
import org.apache.airavata.api.airavataAPIConstants;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.model.error.*;
+import org.apache.airavata.model.error.AiravataClientException;
+import org.apache.airavata.model.error.AiravataErrorType;
+import org.apache.airavata.model.error.AiravataSystemException;
+import org.apache.airavata.model.error.ExperimentNotFoundException;
+import org.apache.airavata.model.error.InvalidRequestException;
+import org.apache.airavata.model.error.LaunchValidationException;
+import org.apache.airavata.model.error.ProjectNotFoundException;
import org.apache.airavata.model.workspace.Project;
+import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
+import org.apache.airavata.model.workspace.experiment.DataObjectType;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+import org.apache.airavata.model.workspace.experiment.ExperimentStatus;
+import org.apache.airavata.model.workspace.experiment.ExperimentSummary;
+import org.apache.airavata.model.workspace.experiment.JobDetails;
+import org.apache.airavata.model.workspace.experiment.JobStatus;
+import org.apache.airavata.model.workspace.experiment.TaskDetails;
+import org.apache.airavata.model.workspace.experiment.UserConfigurationData;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
import org.apache.airavata.orchestrator.client.OrchestratorClientFactory;
import org.apache.airavata.orchestrator.cpi.OrchestratorService;
import org.apache.airavata.orchestrator.cpi.OrchestratorService.Client;
import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.registry.cpi.*;
+import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.ParentDataType;
+import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.registry.cpi.RegistryModelType;
import org.apache.airavata.registry.cpi.utils.Constants;
+import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.TaskDetailConstants;
+import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.WorkflowNodeConstants;
import org.apache.thrift.TException;
-import org.apache.tools.ant.types.selectors.FileSelector;
-import org.apache.zookeeper.*;
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
public class AiravataServerHandler implements Airavata.Iface, Watcher {
private static final Logger logger = LoggerFactory.getLogger(AiravataServerHandler.class);
private Registry registry;
- private OrchestratorService.Client orchestratorClient;
private ZooKeeper zk;
+
private static Integer mutex = -1;
@@ -61,6 +92,7 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
+ ":" + ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.ZOOKEEPER_SERVER_PORT);
String airavataServerHostPort = ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.API_SERVER_HOST)
+ ":" + ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.API_SERVER_PORT);
+
try {
zk = new ZooKeeper(zkhostPort, 6000, this); // no watcher is required, this will only use to store some data
String apiServer = ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.ZOOKEEPER_API_SERVER_NODE,"/airavata-server");
@@ -964,7 +996,7 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
(new Thread() {
public void run() {
try {
- orchestratorClient.launchExperiment(expID);
+ launchSingleAppExperiment(expID, orchestratorClient);
} catch (TException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
@@ -976,10 +1008,56 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
}
}
+ private boolean launchSingleAppExperiment(String experimentId, OrchestratorService.Client orchestratorClient) throws TException {
+ Experiment experiment = null;
+ try {
+ List<String> ids = registry.getIds(RegistryModelType.WORKFLOW_NODE_DETAIL, WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
+ for (String workflowNodeId : ids) {
+// WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) registry.get(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeId);
+ List<Object> taskDetailList = registry.get(RegistryModelType.TASK_DETAIL, TaskDetailConstants.NODE_ID, workflowNodeId);
+ for (Object o : taskDetailList) {
+ TaskDetails taskData = (TaskDetails) o;
+ //iterate through all the generated tasks and performs the job submisssion+monitoring
+ experiment = (Experiment) registry.get(RegistryModelType.EXPERIMENT, experimentId);
+ if (experiment == null) {
+ logger.error("Error retrieving the Experiment by the given experimentID: " + experimentId);
+ return false;
+ }
+ ExperimentStatus status = new ExperimentStatus();
+ status.setExperimentState(ExperimentState.LAUNCHED);
+ status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+ experiment.setExperimentStatus(status);
+ registry.update(RegistryModelType.EXPERIMENT, experiment, experimentId);
+ registry.update(RegistryModelType.TASK_DETAIL, taskData, taskData.getTaskID());
+ //launching the experiment
+ orchestratorClient.launchTask(taskData.getTaskID());
+ }
+ }
+
+ } catch (Exception e) {
+ // Here we really do not have to do much because only potential failure can happen
+ // is in gfac, if there are errors in gfac, it will handle the experiment/task/job statuses
+ // We might get failures in registry access before submitting the jobs to gfac, in that case we
+ // leave the status of these as created.
+ ExperimentStatus status = new ExperimentStatus();
+ status.setExperimentState(ExperimentState.FAILED);
+ status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+ experiment.setExperimentStatus(status);
+ try {
+ registry.update(RegistryModelType.EXPERIMENT, experiment, experimentId);
+ } catch (RegistryException e1) {
+ throw new TException(e);
+ }
+
+ throw new TException(e);
+ }
+ return true;
+ }
+
private OrchestratorService.Client getOrchestratorClient() {
final int serverPort = Integer.parseInt(ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.ORCHESTRATOR_SERVER_PORT,"8940"));
final String serverHost = ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.ORCHESTRATOR_SERVER_HOST, null);
- return orchestratorClient = OrchestratorClientFactory.createOrchestratorClient(serverHost, serverPort);
+ return OrchestratorClientFactory.createOrchestratorClient(serverHost, serverPort);
}
/**
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
index 9e80c24..70000ab 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
@@ -159,18 +159,14 @@ public class RegistryInitUtil {
}
public static void stopDerbyInServerMode() {
- try {
System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "false");
if (server!=null){
- server.shutdown();
+ try {
+ server.shutdown();
+ } catch (Exception e) {
+ logger.error("Error when stopping the derby server : "+e.getLocalizedMessage());
+ }
}
- } catch (IOException e) {
- logger.error("Unable to start Apache derby in the server mode! Check whether " +
- "specified port is available");
- } catch (Exception e) {
- logger.error("Unable to start Apache derby in the server mode! Check whether " +
- "specified port is available");
- }
}
public static int getPort(String jdbcURL){
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/modules/credential-store-service/credential-store/pom.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/pom.xml b/modules/credential-store-service/credential-store/pom.xml
index 534544a..43c11d1 100644
--- a/modules/credential-store-service/credential-store/pom.xml
+++ b/modules/credential-store-service/credential-store/pom.xml
@@ -13,7 +13,7 @@
<groupId>org.apache.airavata</groupId>
<artifactId>airavata</artifactId>
<version>0.13-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
+ <relativePath>../../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
index 05d866b..d90e1df 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
@@ -224,26 +224,29 @@ public class BetterGfacImpl implements GFac {
if (serviceDescription == null) {
throw new GFacException("Error executing the job because there is not Application Name in this Experiment: " + serviceName);
}
- String hostName;
- HostDescription hostDescription = null;
- if (taskData.getTaskScheduling().getResourceHostId() != null) {
- hostName = taskData.getTaskScheduling().getResourceHostId();
- hostDescription = airavataRegistry2.getHostDescriptor(hostName);
- } else {
- List<HostDescription> registeredHosts = new ArrayList<HostDescription>();
- Map<String, ApplicationDescription> applicationDescriptors = airavataRegistry2.getApplicationDescriptors(serviceName);
- for (String hostDescName : applicationDescriptors.keySet()) {
- registeredHosts.add(airavataRegistry2.getHostDescriptor(hostDescName));
- }
- Class<? extends HostScheduler> aClass = Class.forName(ServerSettings.getHostScheduler()).asSubclass(HostScheduler.class);
- HostScheduler hostScheduler = aClass.newInstance();
- hostDescription = hostScheduler.schedule(registeredHosts);
- hostName = hostDescription.getType().getHostName();
- }
- if (hostDescription == null) {
- throw new GFacException("Error executing the job as the host is not registered " + hostName);
- }
- ApplicationDescription applicationDescription = airavataRegistry2.getApplicationDescriptors(serviceName, hostName);
+// String hostName;
+// HostDescription hostDescription = null;
+// if (taskData.getTaskScheduling().getResourceHostId() != null) {
+// hostName = taskData.getTaskScheduling().getResourceHostId();
+// hostDescription = airavataRegistry2.getHostDescriptor(hostName);
+// } else {
+// List<HostDescription> registeredHosts = new ArrayList<HostDescription>();
+// Map<String, ApplicationDescription> applicationDescriptors = airavataRegistry2.getApplicationDescriptors(serviceName);
+// for (String hostDescName : applicationDescriptors.keySet()) {
+// registeredHosts.add(airavataRegistry2.getHostDescriptor(hostDescName));
+// }
+// Class<? extends HostScheduler> aClass = Class.forName(ServerSettings.getHostScheduler()).asSubclass(HostScheduler.class);
+// HostScheduler hostScheduler = aClass.newInstance();
+// hostDescription = hostScheduler.schedule(registeredHosts);
+// hostName = hostDescription.getType().getHostName();
+// }
+// if (hostDescription == null) {
+// throw new GFacException("Error executing the job as the host is not registered " + hostName);
+// }
+// ApplicationDescription applicationDescription = airavataRegistry2.getApplicationDescriptors(serviceName, hostName);
+ HostDescription hostDescription = airavataRegistry2.getHostDescriptor(taskData.getHostDescriptorId());
+ ApplicationDescription applicationDescription = airavataRegistry2.getApplicationDescriptor(serviceName, taskData.getHostDescriptorId(), taskData.getApplicationDescriptorId());
+
URL resource = GFacImpl.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
Properties configurationProperties = ServerSettings.getProperties();
GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()), airavataAPI, configurationProperties);
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/modules/integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/modules/integration-tests/pom.xml b/modules/integration-tests/pom.xml
index 5e5c95f..ea1b6a0 100644
--- a/modules/integration-tests/pom.xml
+++ b/modules/integration-tests/pom.xml
@@ -13,7 +13,7 @@
<parent>
<groupId>org.apache.airavata</groupId>
<artifactId>airavata</artifactId>
- <version>0.12-SNAPSHOT</version>
+ <version>0.13-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java
----------------------------------------------------------------------
diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java
index e9eeb34..b66862e 100644
--- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java
+++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java
@@ -84,7 +84,7 @@ public class DataRetrievalIT extends AbstractIntegrationTest {
private void addProjects() throws TException {
for (int i = 0; i < projects.length; i++){
- Project project = ProjectModelUtil.createProject(projects[i], "admin", "test project");
+ Project project = ProjectModelUtil.createProject(projects[i], "admin", "test project");
String projectId = getClient().createProject(project);
projectIds.add(projectId);
}
@@ -140,7 +140,6 @@ public class DataRetrievalIT extends AbstractIntegrationTest {
List<Project> listUserProjects = listUserProjects(user);
List<String> data = getData(1, user, 2);
data.add("default");
- System.out.println(data.size());
log.info("\t"+user+" : "+data.size()+" projects");
Assert.assertEquals(listUserProjects.size(), 4);
// for (Project project : listUserProjects) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
index abf6a2c..6ff9082 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
@@ -23,282 +23,486 @@ package org.apache.airavata.orchestrator.server;
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
+import java.util.Map;
import java.util.Random;
+import org.apache.airavata.client.AiravataAPIFactory;
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.AiravataZKUtils;
import org.apache.airavata.common.utils.Constants;
import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.core.scheduler.HostScheduler;
import org.apache.airavata.model.error.LaunchValidationException;
-import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.orchestrator.util.OrchestratorRecoveryHandler;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+import org.apache.airavata.model.workspace.experiment.ExperimentStatus;
+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.cpi.OrchestratorService;
import org.apache.airavata.orchestrator.cpi.orchestrator_cpi_serviceConstants;
import org.apache.airavata.orchestrator.cpi.impl.SimpleOrchestratorImpl;
+import org.apache.airavata.orchestrator.util.OrchestratorRecoveryHandler;
import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.Registry;
import org.apache.airavata.registry.cpi.RegistryException;
import org.apache.airavata.registry.cpi.RegistryModelType;
-import org.apache.airavata.registry.cpi.Registry;
import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.TaskDetailConstants;
import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.WorkflowNodeConstants;
import org.apache.thrift.TException;
-import org.apache.zookeeper.*;
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class OrchestratorServerHandler implements OrchestratorService.Iface, Watcher {
- private static Logger log = LoggerFactory.getLogger(OrchestratorServerHandler.class);
+public class OrchestratorServerHandler implements OrchestratorService.Iface,
+ Watcher {
+ private static Logger log = LoggerFactory
+ .getLogger(OrchestratorServerHandler.class);
+
+ private SimpleOrchestratorImpl orchestrator = null;
+
+ private Registry registry;
+
+ private ZooKeeper zk;
- private SimpleOrchestratorImpl orchestrator = null;
+ private static Integer mutex = new Integer(-1);
- private Registry registry;
+ private AiravataAPI airavataAPI;
+ private String airavataUserName;
+ private String gatewayName;
- private ZooKeeper zk;
+ /**
+ * Query orchestrator server to fetch the CPI version
+ */
+ public String getOrchestratorCPIVersion() throws TException {
- private static Integer mutex = new Integer(-1);
- ;
+ return orchestrator_cpi_serviceConstants.ORCHESTRATOR_CPI_VERSION;
+ }
- /**
- * Query orchestrator server to fetch the CPI version
- */
- public String getOrchestratorCPIVersion() throws TException {
+ public OrchestratorServerHandler() {
+ // registering with zk
+ try {
+ String zkhostPort = AiravataZKUtils.getZKhostPort();
+ String airavataServerHostPort = ServerSettings
+ .getSetting(Constants.ORCHESTRATOR_SERVER_HOST)
+ + ":"
+ + ServerSettings
+ .getSetting(Constants.ORCHESTRATOR_SERVER_PORT);
+ setGatewayName(ServerSettings.getSystemUserGateway());
+ setAiravataUserName(ServerSettings.getSystemUser());
+ try {
+ zk = new ZooKeeper(zkhostPort, 6000, this); // no watcher is
+ // required, this
+ // will only use to
+ // store some data
+ String OrchServer = ServerSettings
+ .getSetting(org.apache.airavata.common.utils.Constants.ZOOKEEPER_ORCHESTRATOR_SERVER_NODE);
+ synchronized (mutex) {
+ mutex.wait(); // waiting for the syncConnected event
+ }
+ Stat zkStat = zk.exists(OrchServer, false);
+ if (zkStat == null) {
+ zk.create(OrchServer, new byte[0],
+ ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
+ }
+ String instantNode = OrchServer
+ + File.separator
+ + String.valueOf(new Random()
+ .nextInt(Integer.MAX_VALUE));
+ zkStat = zk.exists(instantNode, false);
+ if (zkStat == null) {
+ zk.create(instantNode, airavataServerHostPort.getBytes(),
+ ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); // other
+ // component
+ // will
+ // watch
+ // these
+ // childeren
+ // creation
+ // deletion
+ // to
+ // monitor
+ // the
+ // status
+ // of
+ // the
+ // node
+ }
+ // creating a watch in orchestrator to monitor the gfac
+ // instances
+ zk.getChildren(ServerSettings.getSetting(
+ Constants.ZOOKEEPER_GFAC_SERVER_NODE, "/gfac-server"),
+ this);
+ log.info("Finished starting ZK: " + zk);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (KeeperException e) {
+ e.printStackTrace();
+ }
+ } catch (ApplicationSettingsException e) {
+ e.printStackTrace();
+ }
+ // orchestrator init
+ try {
+ // first constructing the monitorManager and orchestrator, then fill
+ // the required properties
+ orchestrator = new SimpleOrchestratorImpl();
+ registry = RegistryFactory.getDefaultRegistry();
+ orchestrator.initialize();
+ orchestrator.getOrchestratorContext().setZk(this.zk);
+ } catch (OrchestratorException e) {
+ e.printStackTrace();
+ } catch (RegistryException e) {
+ e.printStackTrace();
+ }
+ }
- return orchestrator_cpi_serviceConstants.ORCHESTRATOR_CPI_VERSION;
- }
+ /**
+ * * After creating the experiment Data user have the * experimentID as the
+ * handler to the experiment, during the launchExperiment * We just have to
+ * give the experimentID * * @param experimentID * @return sucess/failure *
+ * *
+ *
+ * @param experimentId
+ */
+ public boolean launchExperiment(String experimentId) throws TException {
+ Experiment experiment = null;
+ try {
+ List<String> ids = registry.getIds(
+ RegistryModelType.WORKFLOW_NODE_DETAIL,
+ WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
+ for (String workflowNodeId : ids) {
+ WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) registry
+ .get(RegistryModelType.WORKFLOW_NODE_DETAIL,
+ workflowNodeId);
+ List<Object> taskDetailList = registry.get(
+ RegistryModelType.TASK_DETAIL,
+ TaskDetailConstants.NODE_ID, workflowNodeId);
+ for (Object o : taskDetailList) {
+ TaskDetails taskID = (TaskDetails) o;
+ // iterate through all the generated tasks and performs the
+ // job submisssion+monitoring
+ experiment = (Experiment) registry.get(
+ RegistryModelType.EXPERIMENT, experimentId);
+ if (experiment == null) {
+ log.error("Error retrieving the Experiment by the given experimentID: "
+ + experimentId);
+ return false;
+ }
+ ExperimentStatus status = new ExperimentStatus();
+ status.setExperimentState(ExperimentState.LAUNCHED);
+ status.setTimeOfStateChange(Calendar.getInstance()
+ .getTimeInMillis());
+ experiment.setExperimentStatus(status);
+ registry.update(RegistryModelType.EXPERIMENT, experiment,
+ experimentId);
+ // launching the experiment
+ orchestrator.launchExperiment(experiment,
+ workflowNodeDetail, taskID);
+ }
+ }
+ } catch (Exception e) {
+ // Here we really do not have to do much because only potential
+ // failure can happen
+ // is in gfac, if there are errors in gfac, it will handle the
+ // experiment/task/job statuses
+ // We might get failures in registry access before submitting the
+ // jobs to gfac, in that case we
+ // leave the status of these as created.
+ ExperimentStatus status = new ExperimentStatus();
+ status.setExperimentState(ExperimentState.FAILED);
+ status.setTimeOfStateChange(Calendar.getInstance()
+ .getTimeInMillis());
+ experiment.setExperimentStatus(status);
+ try {
+ registry.update(RegistryModelType.EXPERIMENT, experiment,
+ experimentId);
+ } catch (RegistryException e1) {
+ throw new TException(e);
+ }
- public OrchestratorServerHandler() {
- // registering with zk
- try {
- String zkhostPort = AiravataZKUtils.getZKhostPort();
- String airavataServerHostPort = ServerSettings.getSetting(Constants.ORCHESTRATOR_SERVER_HOST)
- + ":" + ServerSettings.getSetting(Constants.ORCHESTRATOR_SERVER_PORT);
- try {
- zk = new ZooKeeper(zkhostPort, 6000, this); // no watcher is required, this will only use to store some data
- String OrchServer = ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.ZOOKEEPER_ORCHESTRATOR_SERVER_NODE);
- synchronized (mutex) {
- mutex.wait(); // waiting for the syncConnected event
- }
- Stat zkStat = zk.exists(OrchServer, false);
- if (zkStat == null) {
- zk.create(OrchServer, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE,
- CreateMode.PERSISTENT);
- }
- String instantNode = OrchServer + File.separator + String.valueOf(new Random().nextInt(Integer.MAX_VALUE));
- zkStat = zk.exists(instantNode, false);
- if (zkStat == null) {
- zk.create(instantNode,
- airavataServerHostPort.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE,
- CreateMode.EPHEMERAL); // other component will watch these childeren creation deletion to monitor the status of the node
- }
- // creating a watch in orchestrator to monitor the gfac instances
- zk.getChildren(ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NODE, "/gfac-server"), this);
- log.info("Finished starting ZK: " + zk);
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- } catch (KeeperException e) {
- e.printStackTrace();
- }
- } catch (ApplicationSettingsException e) {
- e.printStackTrace();
- }
- // orchestrator init
- try {
- // first constructing the monitorManager and orchestrator, then fill the required properties
- orchestrator = new SimpleOrchestratorImpl();
- registry = RegistryFactory.getDefaultRegistry();
- orchestrator.initialize();
- orchestrator.getOrchestratorContext().setZk(this.zk);
- } catch (OrchestratorException e) {
- e.printStackTrace();
- } catch (RegistryException e) {
- e.printStackTrace();
- }
- }
+ throw new TException(e);
+ }
+ return true;
+ }
+ /**
+ * This method will validate the experiment before launching, if is failed
+ * we do not run the launch in airavata thrift service (only if validation
+ * is enabled
+ *
+ * @param experimentId
+ * @return
+ * @throws TException
+ */
+ public boolean validateExperiment(String experimentId) throws TException,
+ LaunchValidationException {
+ // TODO: Write the Orchestrator implementaion
+ try {
+ List<TaskDetails> tasks = orchestrator.createTasks(experimentId);
+ if (tasks.size() > 1) {
+ log.info("There are multiple tasks for this experiment, So Orchestrator will launch multiple Jobs");
+ }
+ List<String> ids = registry.getIds(
+ RegistryModelType.WORKFLOW_NODE_DETAIL,
+ WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
+ for (String workflowNodeId : ids) {
+ WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) registry
+ .get(RegistryModelType.WORKFLOW_NODE_DETAIL,
+ workflowNodeId);
+ List<Object> taskDetailList = registry.get(
+ RegistryModelType.TASK_DETAIL,
+ TaskDetailConstants.NODE_ID, workflowNodeId);
+ for (Object o : taskDetailList) {
+ TaskDetails taskID = (TaskDetails) o;
+ // iterate through all the generated tasks and performs the
+ // job submisssion+monitoring
+ Experiment experiment = (Experiment) registry.get(
+ RegistryModelType.EXPERIMENT, experimentId);
+ if (experiment == null) {
+ log.error("Error retrieving the Experiment by the given experimentID: "
+ + experimentId);
+ return false;
+ }
+ return orchestrator.validateExperiment(experiment,
+ workflowNodeDetail, taskID).isSetValidationState();
+ }
+ }
- /**
- * * After creating the experiment Data user have the
- * * experimentID as the handler to the experiment, during the launchExperiment
- * * We just have to give the experimentID
- * *
- * * @param experimentID
- * * @return sucess/failure
- * *
- * *
- *
- * @param experimentId
- */
- public boolean launchExperiment(String experimentId) throws TException {
- Experiment experiment = null;
- try {
- List<String> ids = registry.getIds(RegistryModelType.WORKFLOW_NODE_DETAIL, WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
- for (String workflowNodeId : ids) {
- WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) registry.get(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeId);
- List<Object> taskDetailList = registry.get(RegistryModelType.TASK_DETAIL, TaskDetailConstants.NODE_ID, workflowNodeId);
- for (Object o : taskDetailList) {
- TaskDetails taskID = (TaskDetails) o;
- //iterate through all the generated tasks and performs the job submisssion+monitoring
- experiment = (Experiment) registry.get(RegistryModelType.EXPERIMENT, experimentId);
- if (experiment == null) {
- log.error("Error retrieving the Experiment by the given experimentID: " + experimentId);
- return false;
- }
- ExperimentStatus status = new ExperimentStatus();
- status.setExperimentState(ExperimentState.LAUNCHED);
- status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
- experiment.setExperimentStatus(status);
- registry.update(RegistryModelType.EXPERIMENT, experiment, experimentId);
- //launching the experiment
- orchestrator.launchExperiment(experiment, workflowNodeDetail, taskID);
- }
- }
+ } catch (OrchestratorException e) {
+ throw new TException(e);
+ } catch (RegistryException e) {
+ throw new TException(e);
+ }
+ return false;
+ }
- } catch (Exception e) {
- // Here we really do not have to do much because only potential failure can happen
- // is in gfac, if there are errors in gfac, it will handle the experiment/task/job statuses
- // We might get failures in registry access before submitting the jobs to gfac, in that case we
- // leave the status of these as created.
- ExperimentStatus status = new ExperimentStatus();
- status.setExperimentState(ExperimentState.FAILED);
- status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
- experiment.setExperimentStatus(status);
- try {
- registry.update(RegistryModelType.EXPERIMENT, experiment, experimentId);
- } catch (RegistryException e1) {
- throw new TException(e);
- }
+ /**
+ * This can be used to cancel a running experiment and store the status to
+ * terminated in registry
+ *
+ * @param experimentId
+ * @return
+ * @throws TException
+ */
+ public boolean terminateExperiment(String experimentId) throws TException {
+ try {
+ orchestrator.cancelExperiment(experimentId);
+ } catch (OrchestratorException e) {
+ log.error("Error canceling experiment " + experimentId, e);
+ return false;
+ }
+ return true;
+ }
- throw new TException(e);
- }
- return true;
- }
+ /**
+ * This method gracefully handler gfac node failures
+ */
+ synchronized public void process(WatchedEvent watchedEvent) {
+ synchronized (mutex) {
+ try {
+ Event.KeeperState state = watchedEvent.getState();
+ switch (state) {
+ case SyncConnected:
+ mutex.notify();
+ break;
+ }
+ if (watchedEvent.getPath() != null
+ && watchedEvent.getPath().startsWith(
+ ServerSettings.getSetting(
+ Constants.ZOOKEEPER_GFAC_SERVER_NODE,
+ "/gfac-server"))) {
+ List<String> children = zk.getChildren(ServerSettings
+ .getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NODE,
+ "/gfac-server"), true);
+ for (String gfacNodes : children) {
+ zk.exists(
+ ServerSettings.getSetting(
+ Constants.ZOOKEEPER_GFAC_SERVER_NODE,
+ "/gfac-server")
+ + File.separator + gfacNodes, this);
+ }
+ switch (watchedEvent.getType()) {
+ case NodeCreated:
+ mutex.notify();
+ break;
+ case NodeDeleted:
+ // here we have to handle gfac node shutdown case
+ if (children.size() == 0) {
+ log.error("There are not gfac instances to route failed jobs");
+ return;
+ }
+ // we recover one gfac node at a time
+ final WatchedEvent event = watchedEvent;
+ final OrchestratorServerHandler handler = this;
+ (new Thread() {
+ public void run() {
+ int retry = 0;
+ while (retry < 3) {
+ try {
+ (new OrchestratorRecoveryHandler(
+ handler, event.getPath()))
+ .recover();
+ break;
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("error recovering the jobs for gfac-node: "
+ + event.getPath());
+ log.error("Retrying again to recover jobs and retry attempt: "
+ + ++retry);
+ }
+ }
+ }
+ }).start();
+ break;
+ }
+ }
+ } catch (KeeperException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
- /**
- * This method will validate the experiment before launching, if is failed we do not run the launch in airavata
- * thrift service (only if validation is enabled
- *
- * @param experimentId
- * @return
- * @throws TException
- */
- public boolean validateExperiment(String experimentId) throws TException, LaunchValidationException {
- //TODO: Write the Orchestrator implementaion
- try {
- List<TaskDetails> tasks = orchestrator.createTasks(experimentId);
- if (tasks.size() > 1) {
- log.info("There are multiple tasks for this experiment, So Orchestrator will launch multiple Jobs");
- }
- List<String> ids = registry.getIds(RegistryModelType.WORKFLOW_NODE_DETAIL, WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
- for (String workflowNodeId : ids) {
- WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) registry.get(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeId);
- List<Object> taskDetailList = registry.get(RegistryModelType.TASK_DETAIL, TaskDetailConstants.NODE_ID, workflowNodeId);
- for (Object o : taskDetailList) {
- TaskDetails taskID = (TaskDetails) o;
- //iterate through all the generated tasks and performs the job submisssion+monitoring
- Experiment experiment = (Experiment) registry.get(RegistryModelType.EXPERIMENT, experimentId);
- if (experiment == null) {
- log.error("Error retrieving the Experiment by the given experimentID: " + experimentId);
- return false;
- }
- return orchestrator.validateExperiment(experiment, workflowNodeDetail, taskID).isSetValidationState();
- }
- }
+ private String getAiravataUserName() {
+ return airavataUserName;
+ }
- } catch (OrchestratorException e) {
- throw new TException(e);
- } catch (RegistryException e) {
- throw new TException(e);
- }
- return false;
- }
+ private String getGatewayName() {
+ return gatewayName;
+ }
- /**
- * This can be used to cancel a running experiment and store the status to terminated in registry
- *
- * @param experimentId
- * @return
- * @throws TException
- */
- public boolean terminateExperiment(String experimentId) throws TException {
- try {
- orchestrator.cancelExperiment(experimentId);
- } catch (OrchestratorException e) {
- log.error("Error canceling experiment " + experimentId, e);
- return false;
- }
- return true;
- }
+ public void setAiravataUserName(String airavataUserName) {
+ this.airavataUserName = airavataUserName;
+ }
- /**
- * This method gracefully handler gfac node failures
- */
- synchronized public void process(WatchedEvent watchedEvent) {
- synchronized (mutex) {
- try {
- Event.KeeperState state = watchedEvent.getState();
- switch (state) {
- case SyncConnected:
- mutex.notify();
- break;
- }
- if (watchedEvent.getPath() != null && watchedEvent.getPath().startsWith(ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NODE, "/gfac-server"))) {
- List<String> children = zk.getChildren(ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NODE, "/gfac-server"), true);
- for (String gfacNodes : children) {
- zk.exists(ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NODE, "/gfac-server") +
- File.separator + gfacNodes, this);
- }
- switch (watchedEvent.getType()) {
- case NodeCreated:
- mutex.notify();
- break;
- case NodeDeleted:
- // here we have to handle gfac node shutdown case
- if (children.size() == 0) {
- log.error("There are not gfac instances to route failed jobs");
- return;
- }
- // we recover one gfac node at a time
- final WatchedEvent event = watchedEvent;
- final OrchestratorServerHandler handler = this;
- (new Thread() {
- public void run() {
- int retry = 0;
- while (retry < 3) {
- try {
- (new OrchestratorRecoveryHandler(handler, event.getPath())).recover();
- break;
- } catch (Exception e) {
- e.printStackTrace();
- log.error("error recovering the jobs for gfac-node: " + event.getPath());
- log.error("Retrying again to recover jobs and retry attempt: " + ++retry);
- }
- }
+ public void setGatewayName(String gatewayName) {
+ this.gatewayName = gatewayName;
+ }
- }
- }).start();
- break;
- }
- }
- } catch (KeeperException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
+ private AiravataAPI getAiravataAPI() {
+ if (airavataAPI == null) {
+ try {
+ airavataAPI = AiravataAPIFactory.getAPI(getGatewayName(),
+ getAiravataUserName());
+ } catch (AiravataAPIInvocationException e) {
+ log.error("Unable to create Airavata API", e);
+ }
+ }
+ return airavataAPI;
+ }
+ @Override
+ public boolean launchTask(String taskId) throws TException {
+ try {
+ TaskDetails taskData = (TaskDetails) registry.get(
+ RegistryModelType.TASK_DETAIL, taskId);
+ String serviceName = taskData.getApplicationId();
+ if (serviceName == null) {
+ throw new GFacException(
+ "Error executing the job because there is not Application Name in this Experiment: "
+ + serviceName);
+ }
+ AiravataAPI airavataAPI = getAiravataAPI();
- @Override
- public boolean launchTask(String taskId) throws TException {
- // TODO Auto-generated method stub
- return false;
- }
+ ServiceDescription serviceDescription = airavataAPI
+ .getApplicationManager().getServiceDescription(serviceName);
+ if (serviceDescription == null) {
+ throw new GFacException(
+ "Error executing the job because there is not Application Name in this Experiment: "
+ + serviceName);
+ }
+ String hostName;
+ HostDescription hostDescription = null;
+ if (taskData.getTaskScheduling().getResourceHostId() != null) {
+ hostName = taskData.getTaskScheduling().getResourceHostId();
+ hostDescription = airavataAPI.getApplicationManager()
+ .getHostDescription(hostName);
+ } else {
+ List<HostDescription> registeredHosts = new ArrayList<HostDescription>();
+ Map<String, ApplicationDescription> applicationDescriptors = airavataAPI
+ .getApplicationManager().getApplicationDescriptors(
+ serviceName);
+ for (String hostDescName : applicationDescriptors.keySet()) {
+ registeredHosts.add(airavataAPI.getApplicationManager()
+ .getHostDescription(hostDescName));
+ }
+ Class<? extends HostScheduler> aClass = Class.forName(
+ ServerSettings.getHostScheduler()).asSubclass(
+ HostScheduler.class);
+ HostScheduler hostScheduler = aClass.newInstance();
+ hostDescription = hostScheduler.schedule(registeredHosts);
+ hostName = hostDescription.getType().getHostName();
+ }
+ if (hostDescription == null) {
+ throw new GFacException(
+ "Error executing the job as the host is not registered "
+ + hostName);
+ }
+ ApplicationDescription applicationDescription = airavataAPI
+ .getApplicationManager().getApplicationDescription(
+ serviceName, hostName);
+ taskData.setHostDescriptorId(hostName);
+ taskData.setApplicationDescriptorId(applicationDescription
+ .getType().getApplicationName().getStringValue());
+ registry.update(RegistryModelType.TASK_DETAIL, taskData,
+ taskData.getTaskID());
+ List<Object> workflowNodeDetailList = registry
+ .get(RegistryModelType.WORKFLOW_NODE_DETAIL,
+ org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.WorkflowNodeConstants.TASK_LIST,
+ taskData);
+ if (workflowNodeDetailList != null
+ && workflowNodeDetailList.size() > 0) {
+ List<Object> experimentList = registry
+ .get(RegistryModelType.EXPERIMENT,
+ org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.ExperimentConstants.WORKFLOW_NODE_LIST,
+ (WorkflowNodeDetails) workflowNodeDetailList
+ .get(0));
+ if (experimentList != null && experimentList.size() > 0) {
+ return orchestrator
+ .launchExperiment(
+ (Experiment) experimentList.get(0),
+ (WorkflowNodeDetails) workflowNodeDetailList
+ .get(0), taskData);
+ }
+ }
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ } catch (ApplicationSettingsException e) {
+ e.printStackTrace();
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (RegistryException e) {
+ e.printStackTrace();
+ } catch (GFacException e) {
+ e.printStackTrace();
+ } catch (AiravataAPIInvocationException e) {
+ e.printStackTrace();
+ } catch (OrchestratorException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/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 fce6dde..b9814bd 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
@@ -24,8 +24,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
+import javax.naming.OperationNotSupportedException;
-import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.model.error.LaunchValidationException;
import org.apache.airavata.model.error.ValidationResults;
import org.apache.airavata.model.error.ValidatorResult;
@@ -37,14 +37,11 @@ import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
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.RegistryModelType;
import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.cpi.RegistryModelType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-import javax.naming.OperationNotSupportedException;
-
public class SimpleOrchestratorImpl extends AbstractOrchestrator{
private final static Logger logger = LoggerFactory.getLogger(SimpleOrchestratorImpl.class);
private ExecutorService executor;
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
index 7a1823a..5998f01 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
@@ -901,6 +901,8 @@ public class ExperimentRegistry {
taskDetail.setApplicationId(taskDetails.getApplicationId());
taskDetail.setApplicationVersion(taskDetails.getApplicationVersion());
taskDetail.setCreationTime(AiravataUtils.getTime(taskDetails.getCreationTime()));
+ taskDetail.setHostDescriptorId(taskDetails.getHostDescriptorId());
+ taskDetail.setApplicationDescriptorId(taskDetails.getApplicationDescriptorId());
taskDetail.save();
List<DataObjectType> applicationInputs = taskDetails.getApplicationInputs();
if (applicationInputs != null) {
@@ -1624,7 +1626,6 @@ public class ExperimentRegistry {
logger.error("Error while updating scheduling data...", e);
throw new RegistryException(e);
}
-
}
public List<Experiment> getExperimentList(String fieldName, Object value) throws RegistryException {
@@ -1655,6 +1656,20 @@ public class ExperimentRegistry {
experiments.add(experiment);
}
return experiments;
+ } if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.WORKFLOW_NODE_LIST)) {
+ if (value instanceof List<?>){
+ return getExperimentList(fieldName,((List<?>) value).get(0));
+ }else if (value instanceof WorkflowNodeDetails){
+ WorkflowNodeDetailResource nodeDetailResource = getWorkflowNodeDetailResource(((WorkflowNodeDetails) value).getNodeInstanceId());
+ if (nodeDetailResource!=null) {
+ return Arrays.asList(new Experiment[] { ThriftDataModelConversion
+ .getExperiment(nodeDetailResource
+ .getExperimentResource()) });
+ }
+ }else{
+ logger.error("Unsupported field value to retrieve workflow node detail list...");
+ }
+
} else {
logger.error("Unsupported field name to retrieve experiment list...");
}
@@ -1670,7 +1685,21 @@ public class ExperimentRegistry {
if (fieldName.equals(Constants.FieldConstants.WorkflowNodeConstants.EXPERIMENT_ID)) {
ExperimentResource experiment = gatewayResource.getExperiment((String) value);
List<WorkflowNodeDetailResource> workflowNodeDetails = experiment.getWorkflowNodeDetails();
+
return ThriftDataModelConversion.getWfNodeList(workflowNodeDetails);
+ } if (fieldName.equals(Constants.FieldConstants.WorkflowNodeConstants.TASK_LIST)) {
+ if (value instanceof List<?>){
+ return getWFNodeDetails(fieldName,((List<?>) value).get(0));
+ }else if (value instanceof TaskDetails){
+ TaskDetailResource taskDetailResource = getTaskDetailResource(((TaskDetails) value).getTaskID());
+ if (taskDetailResource!=null) {
+ return Arrays.asList(new WorkflowNodeDetails[] { ThriftDataModelConversion
+ .getWorkflowNodeDetails(taskDetailResource
+ .getWorkflowNodeDetailResource()) });
+ }
+ }else{
+ logger.error("Unsupported field value to retrieve workflow node detail list...");
+ }
} else {
logger.error("Unsupported field name to retrieve workflow detail list...");
}
@@ -1978,6 +2007,16 @@ public class ExperimentRegistry {
return null;
}
+ private WorkflowNodeDetailResource getWorkflowNodeDetailResource(String nodeId) throws RegistryException {
+ try {
+ ExperimentResource resource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ return resource.getWorkflowNode(nodeId);
+ } catch (Exception e) {
+ logger.error("Error while getting workflow node details...", e);
+ throw new RegistryException(e);
+ }
+ }
+
public WorkflowNodeDetails getWorkflowNodeDetails(String nodeId) throws RegistryException {
try {
ExperimentResource resource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
@@ -2015,9 +2054,7 @@ public class ExperimentRegistry {
public TaskDetails getTaskDetails(String taskId) throws RegistryException {
try {
- ExperimentResource resource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) resource.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
+ TaskDetailResource taskDetail = getTaskDetailResource(taskId);
return ThriftDataModelConversion.getTaskDetail(taskDetail);
} catch (Exception e) {
logger.error("Error while getting task details..", e);
@@ -2025,6 +2062,17 @@ public class ExperimentRegistry {
}
}
+ private TaskDetailResource getTaskDetailResource(String taskId) throws RegistryException {
+ try {
+ ExperimentResource resource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) resource.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ return workflowNode.getTaskDetail(taskId);
+ } catch (Exception e) {
+ logger.error("Error while getting task details..", e);
+ throw new RegistryException(e);
+ }
+ }
+
public List<DataObjectType> getApplicationOutputs(String taskId) throws RegistryException {
try {
ExperimentResource resource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/TaskDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/TaskDetail.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/TaskDetail.java
index 7d3361d..5d0e6b2 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/TaskDetail.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/TaskDetail.java
@@ -43,6 +43,11 @@ public class TaskDetail implements Serializable {
@Column(name = "APPLICATION_VERSION")
private String appVersion;
+ @Column(name = "HOST_ID")
+ private String hostDescriptorId;
+ @Column(name = "APPLICATION_DESC_ID")
+ private String applicationDescriptorId;
+
@ManyToOne(cascade= CascadeType.MERGE)
@JoinColumn(name = "NODE_INSTANCE_ID")
private WorkflowNodeDetail nodeDetail;
@@ -94,4 +99,20 @@ public class TaskDetail implements Serializable {
public void setNodeDetail(WorkflowNodeDetail nodeDetail) {
this.nodeDetail = nodeDetail;
}
+
+ public String getHostDescriptorId() {
+ return hostDescriptorId;
+ }
+
+ public void setHostDescriptorId(String hostDescriptorId) {
+ this.hostDescriptorId = hostDescriptorId;
+ }
+
+ public String getApplicationDescriptorId() {
+ return applicationDescriptorId;
+ }
+
+ public void setApplicationDescriptorId(String applicationDescriptorId) {
+ this.applicationDescriptorId = applicationDescriptorId;
+ }
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
index 8c0c02d..bc7ee1f 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
@@ -45,6 +45,8 @@ public class TaskDetailResource extends AbstractResource {
private Timestamp creationTime;
private String applicationId;
private String applicationVersion;
+ private String hostDescriptorId;
+ private String applicationDescriptorId;
public String getTaskId() {
return taskId;
@@ -465,29 +467,18 @@ public class TaskDetailResource extends AbstractResource {
EntityManager em = null;
try {
em = ResourceUtils.getEntityManager();
- TaskDetail existingTaskDetail = em.find(TaskDetail.class, taskId);
+ TaskDetail taskDetail = em.find(TaskDetail.class, taskId);
em.close();
-
em = ResourceUtils.getEntityManager();
em.getTransaction().begin();
- TaskDetail taskDetail = new TaskDetail();
- taskDetail.setTaskId(taskId);
WorkflowNodeDetail workflowNodeDetail = em.find(WorkflowNodeDetail.class, workflowNodeDetailResource.getNodeInstanceId());
- taskDetail.setNodeDetail(workflowNodeDetail);
- taskDetail.setNodeId(workflowNodeDetailResource.getNodeInstanceId());
- taskDetail.setCreationTime(creationTime);
- taskDetail.setAppId(applicationId);
- taskDetail.setAppVersion(applicationVersion);
- if (existingTaskDetail != null) {
- existingTaskDetail.setTaskId(taskId);
- existingTaskDetail.setNodeDetail(workflowNodeDetail);
- existingTaskDetail.setNodeId(workflowNodeDetailResource.getNodeInstanceId());
- existingTaskDetail.setCreationTime(creationTime);
- existingTaskDetail.setAppId(applicationId);
- existingTaskDetail.setAppVersion(applicationVersion);
- taskDetail = em.merge(existingTaskDetail);
- } else {
+ if (taskDetail != null) {
+ updateTaskDetail(taskDetail, workflowNodeDetail);
em.merge(taskDetail);
+ } else {
+ taskDetail = new TaskDetail();
+ updateTaskDetail(taskDetail, workflowNodeDetail);
+ em.persist(taskDetail);
}
em.getTransaction().commit();
} catch (Exception e) {
@@ -503,6 +494,18 @@ public class TaskDetailResource extends AbstractResource {
}
}
+ private void updateTaskDetail(TaskDetail taskDetail,
+ WorkflowNodeDetail workflowNodeDetail) {
+ taskDetail.setTaskId(taskId);
+ taskDetail.setNodeDetail(workflowNodeDetail);
+ taskDetail.setNodeId(workflowNodeDetailResource.getNodeInstanceId());
+ taskDetail.setCreationTime(creationTime);
+ taskDetail.setAppId(applicationId);
+ taskDetail.setAppVersion(applicationVersion);
+ taskDetail.setHostDescriptorId(getHostDescriptorId());
+ taskDetail.setApplicationDescriptorId(getApplicationDescriptorId());
+ }
+
public List<ApplicationInputResource> getApplicationInputs() throws RegistryException{
List<ApplicationInputResource> applicationInputResources = new ArrayList<ApplicationInputResource>();
List<Resource> resources = get(ResourceType.APPLICATION_INPUT);
@@ -596,4 +599,20 @@ public class TaskDetailResource extends AbstractResource {
public boolean isTaskStatusExist (String taskId) throws RegistryException{
return isExists(ResourceType.STATUS, taskId);
}
+
+ public String getApplicationDescriptorId() {
+ return applicationDescriptorId;
+ }
+
+ public void setApplicationDescriptorId(String applicationDescriptorId) {
+ this.applicationDescriptorId = applicationDescriptorId;
+ }
+
+ public String getHostDescriptorId() {
+ return hostDescriptorId;
+ }
+
+ public void setHostDescriptorId(String hostDescriptorId) {
+ this.hostDescriptorId = hostDescriptorId;
+ }
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
index 05f13c4..3b515d4 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
@@ -636,6 +636,8 @@ public class Utils {
taskDetailResource.setTaskId(o.getTaskId());
taskDetailResource.setApplicationId(o.getAppId());
taskDetailResource.setApplicationVersion(o.getAppVersion());
+ taskDetailResource.setHostDescriptorId(o.getHostDescriptorId());
+ taskDetailResource.setApplicationDescriptorId(o.getApplicationDescriptorId());
}
return taskDetailResource;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
index a66d743..4a06d66 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
@@ -378,6 +378,8 @@ public class ThriftDataModelConversion {
taskDetails.setApplicationInputs(getApplicationInputs(applicationInputs));
List<ApplicationOutputResource> applicationOutputs = taskDetailResource.getApplicationOutputs();
taskDetails.setApplicationOutputs(getApplicationOutputs(applicationOutputs));
+ taskDetails.setHostDescriptorId(taskDetailResource.getHostDescriptorId());
+ taskDetails.setApplicationDescriptorId(taskDetailResource.getApplicationDescriptorId());
if (taskDetailResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, taskId)){
ComputationSchedulingResource computationScheduling = taskDetailResource.getComputationScheduling(taskId);
taskDetails.setTaskScheduling(getComputationalResourceScheduling(computationScheduling));
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql b/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql
index 5bf2c3f..780cd5b 100644
--- a/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql
+++ b/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql
@@ -196,6 +196,8 @@ CREATE TABLE TASK_DETAIL
CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
APPLICATION_ID VARCHAR(255),
APPLICATION_VERSION VARCHAR(255),
+ HOST_ID VARCHAR(255),
+ APPLICATION_DESC_ID VARCHAR(255),
PRIMARY KEY(TASK_ID),
FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
);
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql b/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql
index 385c36b..6353e01 100644
--- a/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql
+++ b/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql
@@ -195,6 +195,8 @@ CREATE TABLE TASK_DETAIL
CREATION_TIME TIMESTAMP DEFAULT NOW(),
APPLICATION_ID VARCHAR(255),
APPLICATION_VERSION VARCHAR(255),
+ HOST_ID VARCHAR(255),
+ APPLICATION_DESC_ID VARCHAR(255),
PRIMARY KEY(TASK_ID),
FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
);
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
----------------------------------------------------------------------
diff --git a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
index 80e0c99..a5caddc 100644
--- a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
+++ b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
@@ -22,7 +22,6 @@ package org.apache.airavata.server;
import java.io.File;
import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.ArrayList;
@@ -49,7 +48,7 @@ public class ServerMain {
private static int serverPID=-1;
private static final String serverStartedFileNamePrefix = "server-start";
private static boolean systemShutDown=false;
- private static boolean shutdownHookCalledBefore=false;
+// private static boolean shutdownHookCalledBefore=false;
static{
servers = new ArrayList<IServer>();
}
@@ -194,19 +193,19 @@ public class ServerMain {
}
}
- private static void deleteOldStartRecords(){
- File[] files = new File(".").listFiles();
- for (File file : files) {
- if (file.getName().contains(serverStartedFileNamePrefix)){
- try {
- new FileOutputStream(file);
- file.delete();
- } catch (Exception e) {
- //file is locked which means there's an active process using it
- }
- }
- }
- }
+// private static void deleteOldStartRecords(){
+// File[] files = new File(".").listFiles();
+// for (File file : files) {
+// if (file.getName().contains(serverStartedFileNamePrefix)){
+// try {
+// new FileOutputStream(file);
+// file.delete();
+// } catch (Exception e) {
+// //file is locked which means there's an active process using it
+// }
+// }
+// }
+// }
private static boolean isServerRunning(){
if (serverPID==-1){
@@ -261,6 +260,7 @@ public class ServerMain {
}
for (IServer server : servers) {
try {
+ server.configure();
server.start();
waitForServerToStart(server,null);
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/e31265cb/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b8b8e73..6698962 100644
--- a/pom.xml
+++ b/pom.xml
@@ -509,6 +509,7 @@
<module>modules/distribution</module>
<module>modules/configuration</module>
<module>modules/ws-messenger</module>
+ <module>modules/integration-tests</module>
</modules>
</profile>
<profile>
[2/2] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/airavata
Posted by sa...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/airavata
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/f0aae9f1
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/f0aae9f1
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/f0aae9f1
Branch: refs/heads/master
Commit: f0aae9f174d177826f373c42f26f79c73b64ba7c
Parents: e31265c 37df1e0
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Fri Jun 27 11:32:13 2014 -0400
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Fri Jun 27 11:32:13 2014 -0400
----------------------------------------------------------------------
.../catalog/data/model/AppEnvironment.java | 75 +++++
.../catalog/data/model/AppEnvironment_PK.java | 62 ++++
.../catalog/data/model/AppInput_PK.java | 62 ++++
.../catalog/data/model/AppModuleMapping.java | 76 +++++
.../catalog/data/model/AppModuleMapping_PK.java | 62 ++++
.../catalog/data/model/AppOutput_PK.java | 62 ++++
.../data/model/ApplicationDeployment.java | 122 ++++++++
.../catalog/data/model/ApplicationInput.java | 115 +++++++
.../data/model/ApplicationInterface.java | 53 ++++
.../catalog/data/model/ApplicationModule.java | 73 +++++
.../catalog/data/model/ApplicationOutput.java | 95 ++++++
.../catalog/data/model/GatewayProfile.java | 73 +++++
.../catalog/data/model/LibraryApendPath.java | 75 +++++
.../catalog/data/model/LibraryApendPath_PK.java | 62 ++++
.../catalog/data/model/LibraryPrepandPath.java | 75 +++++
.../data/model/LibraryPrepandPath_PK.java | 62 ++++
.../data/resources/AbstractResource.java | 60 ++++
.../data/resources/ComputeHostResource.java | 307 +++++++++++++++++++
.../catalog/data/resources/Resource.java | 71 +++--
.../catalog/data/util/AppCatalogJPAUtils.java | 111 +++++++
.../data/util/AppCatalogQueryGenerator.java | 90 ++++++
.../data/util/AppCatalogResourceType.java | 48 +++
.../application/catalog/data/util/JPAUtils.java | 79 -----
.../src/main/resources/META-INF/persistence.xml | 10 +
.../src/main/resources/appcatalog-derby.sql | 99 ++++++
.../src/main/resources/appcatalog-mysql.sql | 100 ++++++
26 files changed, 2068 insertions(+), 111 deletions(-)
----------------------------------------------------------------------