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/03/07 21:51:29 UTC
[1/2] git commit: https://issues.apache.org/jira/browse/AIRAVATA-1046
Repository: airavata
Updated Branches:
refs/heads/master 4932605ec -> 1f298eabd
https://issues.apache.org/jira/browse/AIRAVATA-1046
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/9e71880b
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/9e71880b
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/9e71880b
Branch: refs/heads/master
Commit: 9e71880b1be03fd98bd26e6bbaa2aef40c723711
Parents: 0f7a194
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Fri Mar 7 15:50:51 2014 -0500
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Fri Mar 7 15:50:51 2014 -0500
----------------------------------------------------------------------
.../airavata/api/server/AiravataAPIServer.java | 17 ++++++++--
.../airavata/api/server/util/Constants.java | 27 ++++++++++++++++
.../apache/airavata/common/utils/IServer.java | 1 +
.../resources/conf/airavata-server.properties | 6 +++-
.../orchestrator/server/OrchestratorServer.java | 24 ++++++++++----
.../airavata/orchestrator/util/Constants.java | 27 ++++++++++++++++
.../org/apache/airavata/server/ServerMain.java | 34 +++++++++++++++++---
.../main/resources/airavata-server.properties | 4 +++
8 files changed, 125 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/9e71880b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
index f148ea3..ff51c0b 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
@@ -25,6 +25,7 @@ import org.apache.airavata.api.Airavata;
import org.apache.airavata.api.error.AiravataErrorType;
import org.apache.airavata.api.error.AiravataSystemException;
import org.apache.airavata.api.server.handler.AiravataServerHandler;
+import org.apache.airavata.api.server.util.Constants;
import org.apache.airavata.api.server.util.RegistryInitUtil;
import org.apache.airavata.common.utils.AiravataUtils;
import org.apache.airavata.common.utils.IServer;
@@ -42,7 +43,6 @@ public class AiravataAPIServer implements IServer{
private final static Logger logger = LoggerFactory.getLogger(AiravataAPIServer.class);
//FIXME: Read the port from airavata-server.config file
- private static final String THRIFT_SERVER_PORT = "apiserver.server.port";
private ServerStatus status;
private TSimpleServer server;
@@ -55,10 +55,11 @@ public class AiravataAPIServer implements IServer{
try {
AiravataUtils.setExecutionAsServer();
RegistryInitUtil.initializeDB();
- TServerTransport serverTransport = new TServerSocket(Integer.parseInt(ServerSettings.getSetting(THRIFT_SERVER_PORT,"8930")));
+ int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.THRIFT_SERVER_PORT,"8930"));
+ TServerTransport serverTransport = new TServerSocket(serverPort);
server = new TSimpleServer(
new TServer.Args(serverTransport).processor(mockAiravataServer));
- logger.info("Starting Airavata Mock Airavata Server on Port " + THRIFT_SERVER_PORT);
+ logger.info("Starting Airavata Mock Airavata Server on Port " + serverPort);
logger.info("Listening to Airavata Clients ....");
new Thread() {
public void run() {
@@ -123,4 +124,14 @@ public class AiravataAPIServer implements IServer{
status=stat;
status.updateTime();
}
+
+ @Override
+ public void waitForServerStart() throws Exception {
+ while((getStatus()==ServerStatus.STARTING || getStatus()==ServerStatus.STARTED) && !server.isServing()){
+ Thread.sleep(100);
+ }
+ if (!(getStatus()==ServerStatus.STARTING || getStatus()==ServerStatus.STARTED)){
+ throw new Exception("The server did not start!!!");
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9e71880b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/Constants.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/Constants.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/Constants.java
new file mode 100644
index 0000000..8a5fd34
--- /dev/null
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/Constants.java
@@ -0,0 +1,27 @@
+/*
+ *
+ * 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.util;
+
+public class Constants {
+ public static final String THRIFT_SERVER_PORT = "apiserver.server.port";
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9e71880b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/IServer.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/IServer.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/IServer.java
index 1112218..1187c98 100644
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/IServer.java
+++ b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/IServer.java
@@ -43,4 +43,5 @@ public interface IServer {
public void restart() throws Exception;
public void configure() throws Exception;
public ServerStatus getStatus() throws Exception;
+ public void waitForServerStart() throws Exception;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9e71880b/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
----------------------------------------------------------------------
diff --git a/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties b/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
index 672c7c9..f05f7ae 100644
--- a/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
+++ b/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
@@ -62,7 +62,7 @@ registry.jdbc.url=jdbc:derby://localhost:1527/persistent_data;create=true;user=a
registry.jdbc.user=airavata
registry.jdbc.password=airavata
start.derby.server.mode=true
-validationQuery=SELECT 1 from CONFIGURATION
+validationQuery=SELECT 1 from Configuration
jpa.connection.properties=MaxActive=10,MaxIdle=5,MinIdle=2,MaxWait=60000,testWhileIdle=true,testOnBorrow=true
# Properties to setup registry service
default.registry.user=admin
@@ -272,5 +272,9 @@ threadpool.size=10
start.submitter=true
embedded.mode=true
enable.validation=false
+orchestrator=org.apache.airavata.orchestrator.server.OrchestratorServer
+###---------------------------API Server module Configurations---------------------------###
+apiserver=org.apache.airavata.api.server.AiravataAPIServer
+servers=apiserver,orchestrator
http://git-wip-us.apache.org/repos/asf/airavata/blob/9e71880b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServer.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServer.java b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServer.java
index a333bcf..0b8e676 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServer.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServer.java
@@ -22,7 +22,10 @@
package org.apache.airavata.orchestrator.server;
import org.apache.airavata.common.utils.IServer;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.common.utils.IServer.ServerStatus;
import org.apache.airavata.orchestrator.cpi.OrchestratorService;
+import org.apache.airavata.orchestrator.util.Constants;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TSimpleServer;
import org.apache.thrift.transport.TServerSocket;
@@ -35,8 +38,6 @@ public class OrchestratorServer implements IServer{
private final static Logger logger = LoggerFactory.getLogger(OrchestratorServer.class);
- //FIXME: Read the port from airavata-server.config file
- private static final int ORCHESTRATOT_SERVER_PORT = 8940;
private ServerStatus status;
private TSimpleServer server;
@@ -49,14 +50,17 @@ public class OrchestratorServer implements IServer{
public void StartOrchestratorServer(OrchestratorService.Processor<OrchestratorServerHandler> orchestratorServerHandlerProcessor)
throws Exception {
try {
- TServerTransport serverTransport = new TServerSocket(ORCHESTRATOT_SERVER_PORT);
+ int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.ORCHESTRATOT_SERVER_PORT,"8940"));
+ TServerTransport serverTransport = new TServerSocket(serverPort);
server = new TSimpleServer(
new TServer.Args(serverTransport).processor(orchestratorServerHandlerProcessor));
- logger.info("Starting Orchestrator Server on Port " + ORCHESTRATOT_SERVER_PORT);
+ logger.info("Starting Orchestrator Server on Port " + serverPort);
logger.info("Listening to Orchestrator Clients ....");
new Thread() {
public void run() {
server.serve();
+ setStatus(ServerStatus.STOPPED);
+ logger.info("Orchestrator Server Stopped.");
}
}.start();
setStatus(ServerStatus.STARTED);
@@ -86,8 +90,6 @@ public class OrchestratorServer implements IServer{
public void stop() throws Exception {
if (server.isServing()){
server.stop();
- setStatus(ServerStatus.STOPPED);
- logger.info("Orchestrator Server Stopped.");
}
}
@@ -114,4 +116,14 @@ public class OrchestratorServer implements IServer{
status.updateTime();
}
+ @Override
+ public void waitForServerStart() throws Exception {
+ while((getStatus()==ServerStatus.STARTING || getStatus()==ServerStatus.STARTED) && !server.isServing()){
+ Thread.sleep(100);
+ }
+ if (!(getStatus()==ServerStatus.STARTING || getStatus()==ServerStatus.STARTED)){
+ throw new Exception("The server did not start!!!");
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9e71880b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/Constants.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/Constants.java b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/Constants.java
new file mode 100644
index 0000000..6be3829
--- /dev/null
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/Constants.java
@@ -0,0 +1,27 @@
+/*
+ *
+ * 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.orchestrator.util;
+
+public class Constants {
+ public static final String ORCHESTRATOT_SERVER_PORT = "orchestrator.server.port";
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9e71880b/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 fc79645..69a0034 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
@@ -23,17 +23,40 @@ package org.apache.airavata.server;
import java.util.ArrayList;
import java.util.List;
-import org.apache.airavata.api.server.AiravataAPIServer;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.IServer;
-import org.apache.airavata.orchestrator.server.OrchestratorServer;
+import org.apache.airavata.common.utils.ServerSettings;
public class ServerMain {
private static List<IServer> servers;
-
+ private static final String SERVERS_KEY="servers";
static {
servers = new ArrayList<IServer>();
- servers.add(new AiravataAPIServer());
- servers.add(new OrchestratorServer());
+ try {
+ String serversString = ServerSettings.getSetting(SERVERS_KEY);
+ if (serversString!=null){
+ String[] serversList = serversString.split(",");
+ for (String serverString : serversList) {
+ String serverClassName = ServerSettings.getSetting(serverString);
+ Class<?> classInstance = ServerMain.class
+ .getClassLoader().loadClass(
+ serverClassName);
+ servers.add((IServer)classInstance.newInstance());
+ }
+ }
+ } catch (ApplicationSettingsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
public static void main(String args[]) {
@@ -70,6 +93,7 @@ public class ServerMain {
for (IServer server : servers) {
try {
server.start();
+ server.waitForServerStart();
} catch (Exception e) {
e.printStackTrace();
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9e71880b/modules/server/src/main/resources/airavata-server.properties
----------------------------------------------------------------------
diff --git a/modules/server/src/main/resources/airavata-server.properties b/modules/server/src/main/resources/airavata-server.properties
index ee67de3..f05f7ae 100644
--- a/modules/server/src/main/resources/airavata-server.properties
+++ b/modules/server/src/main/resources/airavata-server.properties
@@ -272,5 +272,9 @@ threadpool.size=10
start.submitter=true
embedded.mode=true
enable.validation=false
+orchestrator=org.apache.airavata.orchestrator.server.OrchestratorServer
+###---------------------------API Server module Configurations---------------------------###
+apiserver=org.apache.airavata.api.server.AiravataAPIServer
+servers=apiserver,orchestrator
[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/1f298eab
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/1f298eab
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/1f298eab
Branch: refs/heads/master
Commit: 1f298eabd66e847b9c656a11a4dfcd1d3c7bf906
Parents: 9e71880 4932605
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Fri Mar 7 15:51:03 2014 -0500
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Fri Mar 7 15:51:03 2014 -0500
----------------------------------------------------------------------
.../java-client-samples/pom.xml | 6 +-
.../client/samples/CreateLaunchExperiment.java | 67 ++++++++++-
.../main/resources/airavata-client.properties | 8 +-
.../airavata/client/tools/DocumentCreator.java | 116 ++++++++++++++++++-
.../monitor/impl/pull/qstat/QstatMonitor.java | 2 +
.../impl/pull/qstat/ResourceConnection.java | 4 +-
.../airavata/job/monitor/state/JobStatus.java | 17 ++-
.../test/resources/airavata-server.properties | 2 +-
.../resources/conf/airavata-client.properties | 2 +-
.../test/resources/airavata-server.properties | 2 +-
.../test/resources/airavata-server.properties | 2 +-
.../main/resources/airavata-server.properties | 2 +-
.../test/resources/airavata-server.properties | 2 +-
.../main/resources/airavata-client.properties | 2 +-
.../main/resources/airavata-server.properties | 2 +-
.../test/resources/airavata-server.properties | 2 +-
.../registry/jpa/impl/ExperimentRegistry.java | 2 +-
.../test/resources/airavata-client.properties | 2 +-
.../main/resources/airavata-server.properties | 2 +-
.../gsi/ssh/api/job/SlurmOutputParser.java | 14 +--
20 files changed, 225 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/1f298eab/modules/server/src/main/resources/airavata-server.properties
----------------------------------------------------------------------