Repository: airavata Updated Branches: refs/heads/master 0c981d6fc -> 82da3d2a7
To start specific servers. Stop stops all the services at this point, need fix. AIRAVATA-1471 Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/589c71c2 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/589c71c2 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/589c71c2 Branch: refs/heads/master Commit: 589c71c230aaf81ab7d133d3bb697b34f017aece Parents: 6e49e37 Author: raminder <[email protected]> Authored: Thu Oct 16 15:54:08 2014 -0400 Committer: raminder <[email protected]> Committed: Thu Oct 16 15:54:08 2014 -0400 ---------------------------------------------------------------------- .../src/main/resources/bin/airavata-server.sh | 5 +- .../server/src/main/resources/bin/api-server.sh | 118 +++++++++++++++++++ .../src/main/resources/bin/gfac-server.sh | 118 +++++++++++++++++++ .../main/resources/bin/orchestrator-server.sh | 118 +++++++++++++++++++ .../src/main/resources/bin/workflow-server.sh | 118 +++++++++++++++++++ .../org/apache/airavata/server/ServerMain.java | 26 ++-- 6 files changed, 493 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/589c71c2/modules/distribution/server/src/main/resources/bin/airavata-server.sh ---------------------------------------------------------------------- diff --git a/modules/distribution/server/src/main/resources/bin/airavata-server.sh b/modules/distribution/server/src/main/resources/bin/airavata-server.sh index e7ed1be..fa41822 100755 --- a/modules/distribution/server/src/main/resources/bin/airavata-server.sh +++ b/modules/distribution/server/src/main/resources/bin/airavata-server.sh @@ -27,10 +27,12 @@ IS_DAEMON_MODE=false LOGO=true STOP=false FORCE=false +SERVERS="--servers=apiserver,orchestrator,gfac,workflowserver" for var in "$@" do case $var in -xdebug) + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS" JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000" shift ;; @@ -39,6 +41,7 @@ do shift ;; start) + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS" IS_DAEMON_MODE=true shift ;; @@ -70,7 +73,7 @@ do exit 0 ;; *) - AIRAVATA_COMMAND="$AIRAVATA_COMMAND $var" + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS $var" shift esac done http://git-wip-us.apache.org/repos/asf/airavata/blob/589c71c2/modules/distribution/server/src/main/resources/bin/api-server.sh ---------------------------------------------------------------------- diff --git a/modules/distribution/server/src/main/resources/bin/api-server.sh b/modules/distribution/server/src/main/resources/bin/api-server.sh new file mode 100755 index 0000000..872c854 --- /dev/null +++ b/modules/distribution/server/src/main/resources/bin/api-server.sh @@ -0,0 +1,118 @@ +#!/bin/bash + +# 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. + +. `dirname $0`/setenv.sh +cd $AIRAVATA_HOME/bin +LOGO_FILE="logo.txt" + +JAVA_OPTS="" +AIRAVATA_COMMAND="" +IS_DAEMON_MODE=false +LOGO=true +STOP=false +FORCE=false +SERVERS="--servers=apiserver" +for var in "$@" +do + case $var in + -xdebug) + JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000" + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS" + shift + ;; + -security) + JAVA_OPTS="$JAVA_OPTS -Djava.security.manager -Djava.security.policy=$AIRAVATA_HOME/conf/axis2.policy -Daxis2.home=$AIRAVATA_HOME" + shift + ;; + start) + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS" + IS_DAEMON_MODE=true + shift + ;; + stop) + LOGO=false + STOP=true + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $var" + shift + ;; + --force) + FORCE=true + shift + ;; + -nologo) + LOGO=false + shift + ;; + -h) + echo "Usage: airavata-server.sh [command-options]" + echo "command options:" + echo " start Start server in daemon mode" + echo " stop [--force] Stop all airavata servers." + echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)" + echo " -nologo Do not show airavata logo" + echo " -xdebug Start Airavata Server under JPDA debugger" + echo " -security Enable Java 2 security" + echo " -h Display this help and exit" + shift + exit 0 + ;; + *) + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS $var" + shift + esac +done +if $LOGO ; then + if [ -e $LOGO_FILE ] + then + cat $LOGO_FILE + fi +fi +if $STOP && $FORCE ; +then + for f in `find . -name "server-start_*"`; do + f_split=(${f//_/ }); + echo "Found process file : $f" + echo -n " Sending kill signals to process ${f_split[1]}..." + out=`kill -9 ${f_split[1]} 2>&1` + if [ -z "$out" ]; then + echo "done" + else + echo "failed (REASON: $out)" + fi + echo -n " Removing process file..." + out=`rm $f 2>&1` + if [ -z "$out" ]; then + echo "done" + else + echo "failed (REASON: $out)" + fi + done +else + if $IS_DAEMON_MODE ; then + echo "Starting airavata server in daemon mode..." + nohup java $JAVA_OPTS -classpath "$XBAYA_CLASSPATH" \ + -Djava.endorsed.dirs="$AIRAVATA_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \ + org.apache.airavata.server.ServerMain $AIRAVATA_COMMAND $* > api-server.out & + else + java $JAVA_OPTS -classpath "$XBAYA_CLASSPATH" \ + -Djava.endorsed.dirs="$AIRAVATA_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \ + org.apache.airavata.server.ServerMain $AIRAVATA_COMMAND $* + fi +fi + http://git-wip-us.apache.org/repos/asf/airavata/blob/589c71c2/modules/distribution/server/src/main/resources/bin/gfac-server.sh ---------------------------------------------------------------------- diff --git a/modules/distribution/server/src/main/resources/bin/gfac-server.sh b/modules/distribution/server/src/main/resources/bin/gfac-server.sh new file mode 100755 index 0000000..839ef4e --- /dev/null +++ b/modules/distribution/server/src/main/resources/bin/gfac-server.sh @@ -0,0 +1,118 @@ +#!/bin/bash + +# 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. + +. `dirname $0`/setenv.sh +cd $AIRAVATA_HOME/bin +LOGO_FILE="logo.txt" + +JAVA_OPTS="" +AIRAVATA_COMMAND="" +IS_DAEMON_MODE=false +LOGO=true +STOP=false +FORCE=false +SERVERS="--servers=gfac" +for var in "$@" +do + case $var in + -xdebug) + JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000" + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS" + shift + ;; + -security) + JAVA_OPTS="$JAVA_OPTS -Djava.security.manager -Djava.security.policy=$AIRAVATA_HOME/conf/axis2.policy -Daxis2.home=$AIRAVATA_HOME" + shift + ;; + start) + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS" + IS_DAEMON_MODE=true + shift + ;; + stop) + LOGO=false + STOP=true + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $var" + shift + ;; + --force) + FORCE=true + shift + ;; + -nologo) + LOGO=false + shift + ;; + -h) + echo "Usage: airavata-server.sh [command-options]" + echo "command options:" + echo " start Start server in daemon mode" + echo " stop [--force] Stop all airavata servers." + echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)" + echo " -nologo Do not show airavata logo" + echo " -xdebug Start Airavata Server under JPDA debugger" + echo " -security Enable Java 2 security" + echo " -h Display this help and exit" + shift + exit 0 + ;; + *) + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS $var" + shift + esac +done +if $LOGO ; then + if [ -e $LOGO_FILE ] + then + cat $LOGO_FILE + fi +fi +if $STOP && $FORCE ; +then + for f in `find . -name "server-start_*"`; do + f_split=(${f//_/ }); + echo "Found process file : $f" + echo -n " Sending kill signals to process ${f_split[1]}..." + out=`kill -9 ${f_split[1]} 2>&1` + if [ -z "$out" ]; then + echo "done" + else + echo "failed (REASON: $out)" + fi + echo -n " Removing process file..." + out=`rm $f 2>&1` + if [ -z "$out" ]; then + echo "done" + else + echo "failed (REASON: $out)" + fi + done +else + if $IS_DAEMON_MODE ; then + echo "Starting airavata server in daemon mode..." + nohup java $JAVA_OPTS -classpath "$XBAYA_CLASSPATH" \ + -Djava.endorsed.dirs="$AIRAVATA_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \ + org.apache.airavata.server.ServerMain $AIRAVATA_COMMAND $* > gfac-server.out & + else + java $JAVA_OPTS -classpath "$XBAYA_CLASSPATH" \ + -Djava.endorsed.dirs="$AIRAVATA_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \ + org.apache.airavata.server.ServerMain $AIRAVATA_COMMAND $* + fi +fi + http://git-wip-us.apache.org/repos/asf/airavata/blob/589c71c2/modules/distribution/server/src/main/resources/bin/orchestrator-server.sh ---------------------------------------------------------------------- diff --git a/modules/distribution/server/src/main/resources/bin/orchestrator-server.sh b/modules/distribution/server/src/main/resources/bin/orchestrator-server.sh new file mode 100755 index 0000000..5fa73e7 --- /dev/null +++ b/modules/distribution/server/src/main/resources/bin/orchestrator-server.sh @@ -0,0 +1,118 @@ +#!/bin/bash + +# 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. + +. `dirname $0`/setenv.sh +cd $AIRAVATA_HOME/bin +LOGO_FILE="logo.txt" + +JAVA_OPTS="" +AIRAVATA_COMMAND="" +IS_DAEMON_MODE=false +LOGO=true +STOP=false +FORCE=false +SERVERS="--servers=orchestrator" +for var in "$@" +do + case $var in + -xdebug) + JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000" + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS" + shift + ;; + -security) + JAVA_OPTS="$JAVA_OPTS -Djava.security.manager -Djava.security.policy=$AIRAVATA_HOME/conf/axis2.policy -Daxis2.home=$AIRAVATA_HOME" + shift + ;; + start) + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS" + IS_DAEMON_MODE=true + shift + ;; + stop) + LOGO=false + STOP=true + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $var" + shift + ;; + --force) + FORCE=true + shift + ;; + -nologo) + LOGO=false + shift + ;; + -h) + echo "Usage: airavata-server.sh [command-options]" + echo "command options:" + echo " start Start server in daemon mode" + echo " stop [--force] Stop all airavata servers." + echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)" + echo " -nologo Do not show airavata logo" + echo " -xdebug Start Airavata Server under JPDA debugger" + echo " -security Enable Java 2 security" + echo " -h Display this help and exit" + shift + exit 0 + ;; + *) + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS $var" + shift + esac +done +if $LOGO ; then + if [ -e $LOGO_FILE ] + then + cat $LOGO_FILE + fi +fi +if $STOP && $FORCE ; +then + for f in `find . -name "server-start_*"`; do + f_split=(${f//_/ }); + echo "Found process file : $f" + echo -n " Sending kill signals to process ${f_split[1]}..." + out=`kill -9 ${f_split[1]} 2>&1` + if [ -z "$out" ]; then + echo "done" + else + echo "failed (REASON: $out)" + fi + echo -n " Removing process file..." + out=`rm $f 2>&1` + if [ -z "$out" ]; then + echo "done" + else + echo "failed (REASON: $out)" + fi + done +else + if $IS_DAEMON_MODE ; then + echo "Starting airavata server in daemon mode..." + nohup java $JAVA_OPTS -classpath "$XBAYA_CLASSPATH" \ + -Djava.endorsed.dirs="$AIRAVATA_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \ + org.apache.airavata.server.ServerMain $AIRAVATA_COMMAND $* > orchestrator-server.out & + else + java $JAVA_OPTS -classpath "$XBAYA_CLASSPATH" \ + -Djava.endorsed.dirs="$AIRAVATA_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \ + org.apache.airavata.server.ServerMain $AIRAVATA_COMMAND $* + fi +fi + http://git-wip-us.apache.org/repos/asf/airavata/blob/589c71c2/modules/distribution/server/src/main/resources/bin/workflow-server.sh ---------------------------------------------------------------------- diff --git a/modules/distribution/server/src/main/resources/bin/workflow-server.sh b/modules/distribution/server/src/main/resources/bin/workflow-server.sh new file mode 100755 index 0000000..b66e192 --- /dev/null +++ b/modules/distribution/server/src/main/resources/bin/workflow-server.sh @@ -0,0 +1,118 @@ +#!/bin/bash + +# 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. + +. `dirname $0`/setenv.sh +cd $AIRAVATA_HOME/bin +LOGO_FILE="logo.txt" + +JAVA_OPTS="" +AIRAVATA_COMMAND="" +IS_DAEMON_MODE=false +LOGO=true +STOP=false +FORCE=false +SERVERS="--servers=workflowserver" +for var in "$@" +do + case $var in + -xdebug) + JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000" + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS" + shift + ;; + -security) + JAVA_OPTS="$JAVA_OPTS -Djava.security.manager -Djava.security.policy=$AIRAVATA_HOME/conf/axis2.policy -Daxis2.home=$AIRAVATA_HOME" + shift + ;; + start) + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS" + IS_DAEMON_MODE=true + shift + ;; + stop) + LOGO=false + STOP=true + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $var" + shift + ;; + --force) + FORCE=true + shift + ;; + -nologo) + LOGO=false + shift + ;; + -h) + echo "Usage: airavata-server.sh [command-options]" + echo "command options:" + echo " start Start server in daemon mode" + echo " stop [--force] Stop all airavata servers." + echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)" + echo " -nologo Do not show airavata logo" + echo " -xdebug Start Airavata Server under JPDA debugger" + echo " -security Enable Java 2 security" + echo " -h Display this help and exit" + shift + exit 0 + ;; + *) + AIRAVATA_COMMAND="$AIRAVATA_COMMAND $SERVERS $var" + shift + esac +done +if $LOGO ; then + if [ -e $LOGO_FILE ] + then + cat $LOGO_FILE + fi +fi +if $STOP && $FORCE ; +then + for f in `find . -name "server-start_*"`; do + f_split=(${f//_/ }); + echo "Found process file : $f" + echo -n " Sending kill signals to process ${f_split[1]}..." + out=`kill -9 ${f_split[1]} 2>&1` + if [ -z "$out" ]; then + echo "done" + else + echo "failed (REASON: $out)" + fi + echo -n " Removing process file..." + out=`rm $f 2>&1` + if [ -z "$out" ]; then + echo "done" + else + echo "failed (REASON: $out)" + fi + done +else + if $IS_DAEMON_MODE ; then + echo "Starting airavata server in daemon mode..." + nohup java $JAVA_OPTS -classpath "$XBAYA_CLASSPATH" \ + -Djava.endorsed.dirs="$AIRAVATA_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \ + org.apache.airavata.server.ServerMain $AIRAVATA_COMMAND $* > workflow-server.out & + else + java $JAVA_OPTS -classpath "$XBAYA_CLASSPATH" \ + -Djava.endorsed.dirs="$AIRAVATA_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \ + org.apache.airavata.server.ServerMain $AIRAVATA_COMMAND $* + fi +fi + http://git-wip-us.apache.org/repos/asf/airavata/blob/589c71c2/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 6aca971..c6e36e8 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 @@ -27,6 +27,7 @@ import java.io.RandomAccessFile; import java.net.URL; import java.util.ArrayList; import java.util.List; +import java.util.Properties; import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.common.utils.*; @@ -57,11 +58,10 @@ public class ServerMain { servers = new ArrayList<IServer>(); } - private static void loadServers() { + private static void loadServers(String serverNames) { try { - String serversString = ServerSettings.getSetting(SERVERS_KEY); - if (serversString!=null){ - String[] serversList = serversString.split(","); + if (serverNames !=null){ + String[] serversList = serverNames.split(","); for (String serverString : serversList) { serverString=serverString.trim(); String serverClassName = ServerSettings.getSetting(serverString); @@ -120,8 +120,7 @@ public class ServerMain { // if (true){ // return; // } - - AiravataUtils.setExecutionAsServer(); + AiravataUtils.setExecutionAsServer(); CommandLineParameters commandLineParameters = StringUtil.getCommandLineParser(args); if (commandLineParameters.getArguments().contains(STOP_COMMAND_STR)){ performServerStopRequest(commandLineParameters); @@ -137,8 +136,17 @@ public class ServerMain { private static void performServerStart(String[] args) { setServerStarted(); logger.info("Airavata server instance starting..."); + for (String string : args) { + logger.info("Server Arguments: " + string); + } ServerSettings.mergeSettingsCommandLineArgs(args); - startAllServers(); + String serverNames; + try { + serverNames = ApplicationSettings.getSetting(SERVERS_KEY); + startAllServers(serverNames); + } catch (ApplicationSettingsException e1) { + logger.error("Error finding servers property"); + } while(!hasStopRequested()){ try { Thread.sleep(2000); @@ -279,9 +287,9 @@ public class ServerMain { } } - public static void startAllServers() { + public static void startAllServers(String serversNames) { if (!serversLoaded){ - loadServers(); + loadServers(serversNames); } for (IServer server : servers) { try {
