Added subset server profile to start api-orch and execution subsets

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

Branch: refs/heads/master
Commit: 5757f1243260dcaf683a852217137b03bd7897bc
Parents: 31f4315
Author: Shameera Rathnayaka <[email protected]>
Authored: Tue Jun 28 16:20:59 2016 -0400
Committer: Shameera Rathnayaka <[email protected]>
Committed: Tue Jun 28 16:32:37 2016 -0400

----------------------------------------------------------------------
 .../main/resources/bin/airavata-server-start.sh | 12 +++---
 .../main/resources/bin/airavata-server-stop.sh  |  7 ++--
 .../org/apache/airavata/server/ServerMain.java  | 40 ++++++++++++--------
 3 files changed, 36 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/5757f124/distribution/src/main/resources/bin/airavata-server-start.sh
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/bin/airavata-server-start.sh 
b/distribution/src/main/resources/bin/airavata-server-start.sh
index a3c9a72..83383bb 100644
--- a/distribution/src/main/resources/bin/airavata-server-start.sh
+++ b/distribution/src/main/resources/bin/airavata-server-start.sh
@@ -27,7 +27,8 @@ EXTRA_ARGS=""
 SERVERS=""
 IS_DAEMON_MODE=false
 LOGO=true
-ALL_IN_ONE=false
+IS_SUBSET=false
+SUBSET=""
 
 # parse command arguments
 for var in "$@"
@@ -50,8 +51,9 @@ do
                fi
             shift
         ;;
-        all)
-            ALL_IN_ONE=true
+        all | api-orch | execution )
+            IS_SUBSET=true
+            SUBSET="${var}"
             shift
             ;;
         -d)
@@ -89,8 +91,8 @@ do
 done
 
 #Construct Airavata command arguments in proper order.
-if ${ALL_IN_ONE} ; then
-    AIRAVATA_COMMAND="--servers=all ${AIRAVATA_COMMAND} ${EXTRA_ARGS}"
+if ${IS_SUBSET} ; then
+    AIRAVATA_COMMAND="--servers=${SUBSET} ${AIRAVATA_COMMAND} ${EXTRA_ARGS}"
 else
     AIRAVATA_COMMAND="--servers=${SERVERS} ${AIRAVATA_COMMAND} ${EXTRA_ARGS}"
 fi

http://git-wip-us.apache.org/repos/asf/airavata/blob/5757f124/distribution/src/main/resources/bin/airavata-server-stop.sh
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/bin/airavata-server-stop.sh 
b/distribution/src/main/resources/bin/airavata-server-stop.sh
index 9ef6681..7f83f48 100644
--- a/distribution/src/main/resources/bin/airavata-server-stop.sh
+++ b/distribution/src/main/resources/bin/airavata-server-stop.sh
@@ -46,11 +46,12 @@ do
 done
 
 if ${FORCE} ; then
-       for f in `find . -name "server-start_*"`; do
+       for f in `find . -name "server_start_*"`; do
+           # split file name using "_" underscore
                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`
+               echo -n "    Sending kill signals to process ${f_split[2]}..."
+               out=`kill -9 ${f_split[2]} 2>&1`
                if [ -z "$out" ]; then
                    echo "done"
                else

http://git-wip-us.apache.org/repos/asf/airavata/blob/5757f124/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 b1db8e1..888a33e 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
@@ -43,18 +43,20 @@ public class ServerMain {
        private static final String SERVERS_KEY="servers";
     private final static Logger logger = 
LoggerFactory.getLogger(ServerMain.class);
     private static boolean serversLoaded=false;
-       private static final String stopFileNamePrefix = "server-stop";
+       private static final String stopFileNamePrefix = "server_stop";
        private static int serverPID=-1;
-       private static final String serverStartedFileNamePrefix = 
"server-start";
+       private static final String serverStartedFileNamePrefix = 
"server_start";
        private static boolean systemShutDown=false;
        private static String STOP_COMMAND_STR = "stop";
 
-       private static String ALL_IN_ONE = "all";
+       private static final String ALL_IN_ONE = "all";
+       private static final String API_ORCH = "api-orch";
+       private static final String EXECUTION = "execution";
        // server names
-       private static String API_SERVER = "apiserver";
-       private static String CREDENTIAL_STORE = "credentialstore";
-       private static String GFAC_SERVER = "gfac";
-       private static String ORCHESTRATOR = "orcestrator";
+       private static final String API_SERVER = "apiserver";
+       private static final String CREDENTIAL_STORE = "credentialstore";
+       private static final String GFAC_SERVER = "gfac";
+       private static final String ORCHESTRATOR = "orcestrator";
 
     private static ServerCnxnFactory cnxnFactory;
 //     private static boolean shutdownHookCalledBefore=false;
@@ -108,14 +110,22 @@ public class ServerMain {
                        serverList.add(API_SERVER);
                        serverList.add(ORCHESTRATOR);
                        serverList.add(GFAC_SERVER);
-                       return serverList;
-               }
-               // credential store should start before api server
-               int credPos = serverList.indexOf(CREDENTIAL_STORE);
-               if (credPos > 0) { // neither absent nor credentialstore is 
first element
-                       String temp = serverList.get(0);
-                       serverList.set(0, serverList.get(credPos));
-                       serverList.set(credPos, temp);
+               } else if (serverList.indexOf(API_ORCH) > -1) {
+                       serverList.clear();
+                       serverList.add(CREDENTIAL_STORE);
+                       serverList.add(API_SERVER);
+                       serverList.add(ORCHESTRATOR);
+               } else if (serverList.indexOf(EXECUTION) > -1) {
+                       serverList.clear();
+                       serverList.add(GFAC_SERVER);
+               } else {
+                       // credential store should start before api server
+                       int credPos = serverList.indexOf(CREDENTIAL_STORE);
+                       if (credPos > 0) { // neither absent nor 
credentialstore is first element
+                               String temp = serverList.get(0);
+                               serverList.set(0, serverList.get(credPos));
+                               serverList.set(credPos, temp);
+                       }
                }
                return serverList;
        }

Reply via email to