This is an automated email from the ASF dual-hosted git repository. dimuthuupe pushed a commit to branch helix-integration in repository https://gitbox.apache.org/repos/asf/airavata.git
commit e864db36b93cc0b55bb4255d699ca851f711005c Author: dimuthu <dimuthu.upeks...@gmail.com> AuthorDate: Wed Mar 7 13:42:32 2018 -0500 Adding deployment module to helix workflows --- modules/airavata-helix-distribution/pom.xml | 55 ++++++++++ .../src/main/assembly/bin-assembly.xml | 111 +++++++++++++++++++++ .../resources/bin/airavata-controller-start.sh | 99 ++++++++++++++++++ .../main/resources/bin/airavata-controller-stop.sh | 71 +++++++++++++ .../main/resources/bin/airavata-monitor-start.sh | 99 ++++++++++++++++++ .../resources/bin/airavata-participant-start.sh | 99 ++++++++++++++++++ .../resources/bin/airavata-participant-stop.sh | 71 +++++++++++++ .../main/resources/bin/airavata-post-wm-start.sh | 99 ++++++++++++++++++ .../main/resources/bin/airavata-post-wm-stop.sh | 71 +++++++++++++ .../main/resources/bin/airavata-pre-wm-start.sh | 99 ++++++++++++++++++ .../src/main/resources/bin/airavata-pre-wm-stop.sh | 71 +++++++++++++ .../src/main/resources/bin/setenv.sh | 46 +++++++++ .../resources/conf}/airavata-server.properties | 15 ++- .../src/main/resources/conf/application.properties | 3 + .../src/main/resources/conf/cred_store.jks | Bin 0 -> 499 bytes .../src/main/resources/conf/log4j.properties | 13 +++ .../helix/core/participant/HelixParticipant.java | 9 +- modules/helix-spectator/pom.xml | 2 +- .../helix/impl}/controller/HelixController.java | 40 +++++++- .../helix/impl/participant/GlobalParticipant.java | 33 +++++- .../helix/impl/task/TaskOnFailException.java | 1 - .../impl/task/submission/config/GroovyMapData.java | 6 +- .../helix/impl/workflow/PostWorkflowManager.java | 70 ++----------- .../helix/impl/workflow/PreWorkflowManager.java | 17 ++-- .../src/main/resources/airavata-server.properties | 15 ++- pom.xml | 4 +- 26 files changed, 1128 insertions(+), 91 deletions(-) diff --git a/modules/airavata-helix-distribution/pom.xml b/modules/airavata-helix-distribution/pom.xml new file mode 100644 index 0000000..e1001ad --- /dev/null +++ b/modules/airavata-helix-distribution/pom.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>airavata</artifactId> + <groupId>org.apache.airavata</groupId> + <version>0.17-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>airavata-helix-distribution</artifactId> + + <dependencies> + <dependency> + <groupId>org.apache.airavata</groupId> + <artifactId>helix-spectator</artifactId> + <version>0.17-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.5.5</version> + <executions> + <execution> + <id>distribution-package</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <tarLongFileMode>posix</tarLongFileMode> + <finalName>${archieve.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/main/assembly/bin-assembly.xml</descriptor> + <!-- <descriptor>src/main/assembly/src-assembly.xml</descriptor> --> + </descriptors> + <attach>false</attach> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <properties> + <archieve.name>helix-spectator</archieve.name> + </properties> + +</project> \ No newline at end of file diff --git a/modules/airavata-helix-distribution/src/main/assembly/bin-assembly.xml b/modules/airavata-helix-distribution/src/main/assembly/bin-assembly.xml new file mode 100644 index 0000000..d1b77c4 --- /dev/null +++ b/modules/airavata-helix-distribution/src/main/assembly/bin-assembly.xml @@ -0,0 +1,111 @@ +<!-- + + + 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. + +--> +<!DOCTYPE assembly [ + <!ELEMENT assembly (id|includeBaseDirectory|baseDirectory|formats|fileSets|dependencySets)*> + <!ELEMENT id (#PCDATA)> + <!ELEMENT includeBaseDirectory (#PCDATA)> + <!ELEMENT baseDirectory (#PCDATA)> + <!ELEMENT formats (format)*> + <!ELEMENT format (#PCDATA)> + <!ELEMENT fileSets (fileSet)*> + <!ELEMENT fileSet (directory|outputDirectory|fileMode|includes)*> + <!ELEMENT directory (#PCDATA)> + <!ELEMENT outputDirectory (#PCDATA)> + <!ELEMENT includes (include)*> + <!ELEMENT include (#PCDATA)> + <!ELEMENT dependencySets (dependencySet)*> + <!ELEMENT dependencySet (outputDirectory|outputFileNameMapping|includes)*> + ]> +<assembly> + <id>bin</id> + <includeBaseDirectory>true</includeBaseDirectory> + <baseDirectory>${archieve.name}-${version}</baseDirectory> + <formats> + <format>tar.gz</format> + <format>zip</format> + </formats> + + <fileSets> + + + <!-- ********************** copy database scripts ********************** --> + <fileSet> + <directory>src/main/resources/bin</directory> + <outputDirectory>bin</outputDirectory> + <fileMode>777</fileMode> + <includes> + <include>*.sh</include> + </includes> + </fileSet> + <fileSet> + <directory>src/main/resources/conf</directory> + <outputDirectory>bin</outputDirectory> + <fileMode>777</fileMode> + <includes> + <include>airavata-server.properties</include> + </includes> + </fileSet> + <fileSet> + <directory>src/main/resources/conf</directory> + <outputDirectory>conf</outputDirectory> + <includes> + <include>airavata-server.properties</include> + <include>application.properties</include> + <include>log4j.properties</include> + <include>cred_store.jks</include> + <include>PBS_Groovy.template</include> + <include>SLURM_Groovy.template</include> + <include>LSF_Groovy.template</include> + <include>UGE_Groovy.template</include> + <include>FORK_Groovy.template</include> + </includes> + </fileSet> + + <!-- Create logs directory --> + <fileSet> + <directory>./</directory> + <outputDirectory>logs</outputDirectory> + <excludes> + <exclude>*/**</exclude> + </excludes> + </fileSet> + + + </fileSets> + + <dependencySets> + + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <outputDirectory>lib</outputDirectory> + <includes> + <include>*:*:jar</include> + + </includes> + <excludes> + <exclude>mysql:mysql-connector-java</exclude> + <exclude>ch.qos.logback:logback-classic:jar</exclude> + </excludes> + </dependencySet> + </dependencySets> + +</assembly> diff --git a/modules/airavata-helix-distribution/src/main/resources/bin/airavata-controller-start.sh b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-controller-start.sh new file mode 100644 index 0000000..d3556fb --- /dev/null +++ b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-controller-start.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env 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 +# Capture user's working dir before changing directory +CWD="$PWD" +cd ${AIRAVATA_HOME}/bin +LOGO_FILE="logo.txt" + +JAVA_OPTS="" +AIRAVATA_COMMAND="" +EXTRA_ARGS="" +SERVERS="" +IS_DAEMON_MODE=false +LOGO=true +IS_SUBSET=false +SUBSET="" +DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/controller-output.log" +LOG_FILE=$DEFAULT_LOG_FILE + +# parse command arguments +for var in "$@" +do + case ${var} in + -xdebug) + AIRAVATA_COMMAND="${AIRAVATA_COMMAND}" + JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000" + shift + ;; + -security) + JAVA_OPTS="${JAVA_OPTS} -Djava.security.manager -Djava.security.policy=${AIRAVATA_HOME}/conf/axis2.policy -Daxis2.home=${AIRAVATA_HOME}" + shift + ;; + -d) + IS_DAEMON_MODE=true + shift + ;; + -nologo) + LOGO=false + shift + ;; + -log) + shift + LOG_FILE="$1" + shift + # If relative path, expand to absolute path using the user's $CWD + if [ -z "`echo "$LOG_FILE" | egrep "^/"`" ]; then + LOG_FILE="${CWD}/${LOG_FILE}" + fi + ;; + -h) + echo "Usage: airavata-participant-start.sh" + + echo "command options:" + echo " -d Start server in daemon mode" + echo " -xdebug Start Airavata Server under JPDA debugger" + echo " -nologo Do not show airavata logo" + echo " -security Enable Java 2 security" + echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)" + echo " -log <LOG_FILE> Where to redirect stdout/stderr (defaults to $DEFAULT_LOG_FILE)" + echo " -h Display this help and exit" + shift + exit 0 + ;; + *) + EXTRA_ARGS="${EXTRA_ARGS} ${var}" + shift + ;; + esac +done + +AIRAVATA_COMMAND="--confDir=${AIRAVATA_HOME}/conf" + +if ${IS_DAEMON_MODE} ; then + echo "Starting airavata server/s in daemon mode..." + echo "Redirecting output to $LOG_FILE" + nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.helix.impl.controller.HelixController ${AIRAVATA_COMMAND} $* > $LOG_FILE 2>&1 & +else + java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.helix.impl.controller.HelixController ${AIRAVATA_COMMAND} $* +fi + diff --git a/modules/airavata-helix-distribution/src/main/resources/bin/airavata-controller-stop.sh b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-controller-stop.sh new file mode 100644 index 0000000..b76aa4d --- /dev/null +++ b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-controller-stop.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env 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 + +JAVA_OPTS="" +AIRAVATA_COMMAND="" +FORCE=false + +for var in "$@" +do + case ${var} in + -f | --force) + FORCE=true + shift + ;; + -h) + echo "Usage: airavata-controller-stop.sh [command-options]" + echo "command options:" + echo " -f , --force Force stop all airavata servers." + echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)" + echo " -h Display this help and exit" + shift + exit 0 + ;; + *) + shift + esac +done + +if ${FORCE} ; then + for f in `find . -name "controller_start_*"`; do + # split file name using "_" underscore + f_split=(${f//_/ }); + echo "Found process file : $f" + 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 + 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 + java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.server.ServerMain stop ${AIRAVATA_COMMAND} $* +fi diff --git a/modules/airavata-helix-distribution/src/main/resources/bin/airavata-monitor-start.sh b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-monitor-start.sh new file mode 100644 index 0000000..5e848bb --- /dev/null +++ b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-monitor-start.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env 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 +# Capture user's working dir before changing directory +CWD="$PWD" +cd ${AIRAVATA_HOME}/bin +LOGO_FILE="logo.txt" + +JAVA_OPTS="" +AIRAVATA_COMMAND="" +EXTRA_ARGS="" +SERVERS="" +IS_DAEMON_MODE=false +LOGO=true +IS_SUBSET=false +SUBSET="" +DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/monitor-output.log" +LOG_FILE=$DEFAULT_LOG_FILE + +# parse command arguments +for var in "$@" +do + case ${var} in + -xdebug) + AIRAVATA_COMMAND="${AIRAVATA_COMMAND}" + JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000" + shift + ;; + -security) + JAVA_OPTS="${JAVA_OPTS} -Djava.security.manager -Djava.security.policy=${AIRAVATA_HOME}/conf/axis2.policy -Daxis2.home=${AIRAVATA_HOME}" + shift + ;; + -d) + IS_DAEMON_MODE=true + shift + ;; + -nologo) + LOGO=false + shift + ;; + -log) + shift + LOG_FILE="$1" + shift + # If relative path, expand to absolute path using the user's $CWD + if [ -z "`echo "$LOG_FILE" | egrep "^/"`" ]; then + LOG_FILE="${CWD}/${LOG_FILE}" + fi + ;; + -h) + echo "Usage: airavata-participant-start.sh" + + echo "command options:" + echo " -d Start server in daemon mode" + echo " -xdebug Start Airavata Server under JPDA debugger" + echo " -nologo Do not show airavata logo" + echo " -security Enable Java 2 security" + echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)" + echo " -log <LOG_FILE> Where to redirect stdout/stderr (defaults to $DEFAULT_LOG_FILE)" + echo " -h Display this help and exit" + shift + exit 0 + ;; + *) + EXTRA_ARGS="${EXTRA_ARGS} ${var}" + shift + ;; + esac +done + +AIRAVATA_COMMAND="--confDir=${AIRAVATA_HOME}/conf" + +if ${IS_DAEMON_MODE} ; then + echo "Starting airavata server/s in daemon mode..." + echo "Redirecting output to $LOG_FILE" + nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.job.monitor.EmailBasedMonitor ${AIRAVATA_COMMAND} $* > $LOG_FILE 2>&1 & +else + java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.job.monitor.EmailBasedMonitor ${AIRAVATA_COMMAND} $* +fi + diff --git a/modules/airavata-helix-distribution/src/main/resources/bin/airavata-participant-start.sh b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-participant-start.sh new file mode 100644 index 0000000..0d39101 --- /dev/null +++ b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-participant-start.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env 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 +# Capture user's working dir before changing directory +CWD="$PWD" +cd ${AIRAVATA_HOME}/bin +LOGO_FILE="logo.txt" + +JAVA_OPTS="" +AIRAVATA_COMMAND="" +EXTRA_ARGS="" +SERVERS="" +IS_DAEMON_MODE=false +LOGO=true +IS_SUBSET=false +SUBSET="" +DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/participant-output.log" +LOG_FILE=$DEFAULT_LOG_FILE + +# parse command arguments +for var in "$@" +do + case ${var} in + -xdebug) + AIRAVATA_COMMAND="${AIRAVATA_COMMAND}" + JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000" + shift + ;; + -security) + JAVA_OPTS="${JAVA_OPTS} -Djava.security.manager -Djava.security.policy=${AIRAVATA_HOME}/conf/axis2.policy -Daxis2.home=${AIRAVATA_HOME}" + shift + ;; + -d) + IS_DAEMON_MODE=true + shift + ;; + -nologo) + LOGO=false + shift + ;; + -log) + shift + LOG_FILE="$1" + shift + # If relative path, expand to absolute path using the user's $CWD + if [ -z "`echo "$LOG_FILE" | egrep "^/"`" ]; then + LOG_FILE="${CWD}/${LOG_FILE}" + fi + ;; + -h) + echo "Usage: airavata-participant-start.sh [server-name/s] [command-options]" + + echo "command options:" + echo " -d Start server in daemon mode" + echo " -xdebug Start Airavata Server under JPDA debugger" + echo " -nologo Do not show airavata logo" + echo " -security Enable Java 2 security" + echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)" + echo " -log <LOG_FILE> Where to redirect stdout/stderr (defaults to $DEFAULT_LOG_FILE)" + echo " -h Display this help and exit" + shift + exit 0 + ;; + *) + EXTRA_ARGS="${EXTRA_ARGS} ${var}" + shift + ;; + esac +done + +AIRAVATA_COMMAND="--confDir=${AIRAVATA_HOME}/conf" + +if ${IS_DAEMON_MODE} ; then + echo "Starting airavata server/s in daemon mode..." + echo "Redirecting output to $LOG_FILE" + nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.helix.impl.participant.GlobalParticipant ${AIRAVATA_COMMAND} $* > $LOG_FILE 2>&1 & +else + java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.helix.impl.participant.GlobalParticipant ${AIRAVATA_COMMAND} $* +fi + diff --git a/modules/airavata-helix-distribution/src/main/resources/bin/airavata-participant-stop.sh b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-participant-stop.sh new file mode 100644 index 0000000..be1200c --- /dev/null +++ b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-participant-stop.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env 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 + +JAVA_OPTS="" +AIRAVATA_COMMAND="" +FORCE=false + +for var in "$@" +do + case ${var} in + -f | --force) + FORCE=true + shift + ;; + -h) + echo "Usage: airavata-participant-stop.sh [command-options]" + echo "command options:" + echo " -f , --force Force stop all airavata servers." + echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)" + echo " -h Display this help and exit" + shift + exit 0 + ;; + *) + shift + esac +done + +if ${FORCE} ; then + for f in `find . -name "participant_start_*"`; do + # split file name using "_" underscore + f_split=(${f//_/ }); + echo "Found process file : $f" + 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 + 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 + java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.server.ServerMain stop ${AIRAVATA_COMMAND} $* +fi diff --git a/modules/airavata-helix-distribution/src/main/resources/bin/airavata-post-wm-start.sh b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-post-wm-start.sh new file mode 100644 index 0000000..2b9ae83 --- /dev/null +++ b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-post-wm-start.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env 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 +# Capture user's working dir before changing directory +CWD="$PWD" +cd ${AIRAVATA_HOME}/bin +LOGO_FILE="logo.txt" + +JAVA_OPTS="" +AIRAVATA_COMMAND="" +EXTRA_ARGS="" +SERVERS="" +IS_DAEMON_MODE=false +LOGO=true +IS_SUBSET=false +SUBSET="" +DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/post-wm-output.log" +LOG_FILE=$DEFAULT_LOG_FILE + +# parse command arguments +for var in "$@" +do + case ${var} in + -xdebug) + AIRAVATA_COMMAND="${AIRAVATA_COMMAND}" + JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000" + shift + ;; + -security) + JAVA_OPTS="${JAVA_OPTS} -Djava.security.manager -Djava.security.policy=${AIRAVATA_HOME}/conf/axis2.policy -Daxis2.home=${AIRAVATA_HOME}" + shift + ;; + -d) + IS_DAEMON_MODE=true + shift + ;; + -nologo) + LOGO=false + shift + ;; + -log) + shift + LOG_FILE="$1" + shift + # If relative path, expand to absolute path using the user's $CWD + if [ -z "`echo "$LOG_FILE" | egrep "^/"`" ]; then + LOG_FILE="${CWD}/${LOG_FILE}" + fi + ;; + -h) + echo "Usage: airavata-participant-start.sh" + + echo "command options:" + echo " -d Start server in daemon mode" + echo " -xdebug Start Airavata Server under JPDA debugger" + echo " -nologo Do not show airavata logo" + echo " -security Enable Java 2 security" + echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)" + echo " -log <LOG_FILE> Where to redirect stdout/stderr (defaults to $DEFAULT_LOG_FILE)" + echo " -h Display this help and exit" + shift + exit 0 + ;; + *) + EXTRA_ARGS="${EXTRA_ARGS} ${var}" + shift + ;; + esac +done + +AIRAVATA_COMMAND="--confDir=${AIRAVATA_HOME}/conf" + +if ${IS_DAEMON_MODE} ; then + echo "Starting airavata server/s in daemon mode..." + echo "Redirecting output to $LOG_FILE" + nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.helix.impl.workflow.PostWorkflowManager ${AIRAVATA_COMMAND} $* > $LOG_FILE 2>&1 & +else + java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.helix.impl.workflow.PostWorkflowManager ${AIRAVATA_COMMAND} $* +fi + diff --git a/modules/airavata-helix-distribution/src/main/resources/bin/airavata-post-wm-stop.sh b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-post-wm-stop.sh new file mode 100644 index 0000000..4493d6e --- /dev/null +++ b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-post-wm-stop.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env 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 + +JAVA_OPTS="" +AIRAVATA_COMMAND="" +FORCE=false + +for var in "$@" +do + case ${var} in + -f | --force) + FORCE=true + shift + ;; + -h) + echo "Usage: airavata-post-wm-stop.sh [command-options]" + echo "command options:" + echo " -f , --force Force stop all airavata servers." + echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)" + echo " -h Display this help and exit" + shift + exit 0 + ;; + *) + shift + esac +done + +if ${FORCE} ; then + for f in `find . -name "post_wm_start_*"`; do + # split file name using "_" underscore + f_split=(${f//_/ }); + echo "Found process file : $f" + 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 + 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 + java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.server.ServerMain stop ${AIRAVATA_COMMAND} $* +fi diff --git a/modules/airavata-helix-distribution/src/main/resources/bin/airavata-pre-wm-start.sh b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-pre-wm-start.sh new file mode 100644 index 0000000..8d0b838 --- /dev/null +++ b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-pre-wm-start.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env 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 +# Capture user's working dir before changing directory +CWD="$PWD" +cd ${AIRAVATA_HOME}/bin +LOGO_FILE="logo.txt" + +JAVA_OPTS="" +AIRAVATA_COMMAND="" +EXTRA_ARGS="" +SERVERS="" +IS_DAEMON_MODE=false +LOGO=true +IS_SUBSET=false +SUBSET="" +DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/pre-wm-output.log" +LOG_FILE=$DEFAULT_LOG_FILE + +# parse command arguments +for var in "$@" +do + case ${var} in + -xdebug) + AIRAVATA_COMMAND="${AIRAVATA_COMMAND}" + JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000" + shift + ;; + -security) + JAVA_OPTS="${JAVA_OPTS} -Djava.security.manager -Djava.security.policy=${AIRAVATA_HOME}/conf/axis2.policy -Daxis2.home=${AIRAVATA_HOME}" + shift + ;; + -d) + IS_DAEMON_MODE=true + shift + ;; + -nologo) + LOGO=false + shift + ;; + -log) + shift + LOG_FILE="$1" + shift + # If relative path, expand to absolute path using the user's $CWD + if [ -z "`echo "$LOG_FILE" | egrep "^/"`" ]; then + LOG_FILE="${CWD}/${LOG_FILE}" + fi + ;; + -h) + echo "Usage: airavata-participant-start.sh" + + echo "command options:" + echo " -d Start server in daemon mode" + echo " -xdebug Start Airavata Server under JPDA debugger" + echo " -nologo Do not show airavata logo" + echo " -security Enable Java 2 security" + echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)" + echo " -log <LOG_FILE> Where to redirect stdout/stderr (defaults to $DEFAULT_LOG_FILE)" + echo " -h Display this help and exit" + shift + exit 0 + ;; + *) + EXTRA_ARGS="${EXTRA_ARGS} ${var}" + shift + ;; + esac +done + +AIRAVATA_COMMAND="--confDir=${AIRAVATA_HOME}/conf" + +if ${IS_DAEMON_MODE} ; then + echo "Starting airavata server/s in daemon mode..." + echo "Redirecting output to $LOG_FILE" + nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.helix.impl.workflow.PreWorkflowManager ${AIRAVATA_COMMAND} $* > $LOG_FILE 2>&1 & +else + java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.helix.impl.workflow.PreWorkflowManager ${AIRAVATA_COMMAND} $* +fi + diff --git a/modules/airavata-helix-distribution/src/main/resources/bin/airavata-pre-wm-stop.sh b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-pre-wm-stop.sh new file mode 100644 index 0000000..4493d6e --- /dev/null +++ b/modules/airavata-helix-distribution/src/main/resources/bin/airavata-pre-wm-stop.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env 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 + +JAVA_OPTS="" +AIRAVATA_COMMAND="" +FORCE=false + +for var in "$@" +do + case ${var} in + -f | --force) + FORCE=true + shift + ;; + -h) + echo "Usage: airavata-post-wm-stop.sh [command-options]" + echo "command options:" + echo " -f , --force Force stop all airavata servers." + echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)" + echo " -h Display this help and exit" + shift + exit 0 + ;; + *) + shift + esac +done + +if ${FORCE} ; then + for f in `find . -name "post_wm_start_*"`; do + # split file name using "_" underscore + f_split=(${f//_/ }); + echo "Found process file : $f" + 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 + 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 + java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \ + org.apache.airavata.server.ServerMain stop ${AIRAVATA_COMMAND} $* +fi diff --git a/modules/airavata-helix-distribution/src/main/resources/bin/setenv.sh b/modules/airavata-helix-distribution/src/main/resources/bin/setenv.sh new file mode 100755 index 0000000..9e894e1 --- /dev/null +++ b/modules/airavata-helix-distribution/src/main/resources/bin/setenv.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +# 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. + +# resolve links - $0 may be a softlink +PRG="$0" + +while [ -h "$PRG" ]; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '.*/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`/"$link" + fi +done + +PRGDIR=`dirname "$PRG"` + +# Only set AIRAVATA_HOME if not already set +[ -z "$AIRAVATA_HOME" ] && AIRAVATA_HOME=`cd "$PRGDIR/.." ; pwd` + +AIRAVATA_CLASSPATH="" + +for f in "$AIRAVATA_HOME"/lib/*.jar +do + AIRAVATA_CLASSPATH="$AIRAVATA_CLASSPATH":$f +done + +export AIRAVATA_HOME +export AIRAVATA_CLASSPATH diff --git a/modules/helix-spectator/src/main/resources/airavata-server.properties b/modules/airavata-helix-distribution/src/main/resources/conf/airavata-server.properties similarity index 96% copy from modules/helix-spectator/src/main/resources/airavata-server.properties copy to modules/airavata-helix-distribution/src/main/resources/conf/airavata-server.properties index b54b28c..19b3b3d 100644 --- a/modules/helix-spectator/src/main/resources/airavata-server.properties +++ b/modules/airavata-helix-distribution/src/main/resources/conf/airavata-server.properties @@ -260,13 +260,24 @@ email.based.monitor.store.protocol=imaps email.based.monitoring.period=10000 ########################################################################### +#Helix workflow manager configurations +########################################################################### + +kafka.broker.url=localhost:9092 +kafka.broker.topic=parsed-data +kafka.broker.consumer.group=MonitoringConsumer +helix.cluster.name=AiravataDemoCluster +pre.workflow.manager.name=prewm +post.workflow.manager.name=postwm + +########################################################################### # AMQP Notification Configuration ########################################################################### #for simple scenarios we can use the guest user #rabbitmq.broker.url=amqp://localhost:5672 #for production scenarios, give url as amqp://userName:password@hostName:portNumber/virtualHost, create user, virtualhost # and give permissions, refer: http://blog.dtzq.com/2012/06/rabbitmq-users-and-virtual-hosts.html -rabbitmq.broker.url=amqp://airavata:123456@192.168.99.102:5672/master +rabbitmq.broker.url=amqp://rabbit:rabbit123456@149.165.168.248:5672/master rabbitmq.status.exchange.name=status_exchange rabbitmq.process.exchange.name=process_exchange rabbitmq.experiment.exchange.name=experiment_exchange @@ -279,7 +290,7 @@ experiment.launch..queue.name=experiment.launch.queue # Zookeeper Server Configuration ########################################################################### embedded.zk=false -zookeeper.server.connection=192.168.99.102:2181 +zookeeper.server.connection=localhost:2199 zookeeper.timeout=30000 ######################################################################## diff --git a/modules/airavata-helix-distribution/src/main/resources/conf/application.properties b/modules/airavata-helix-distribution/src/main/resources/conf/application.properties new file mode 100644 index 0000000..b4b8048 --- /dev/null +++ b/modules/airavata-helix-distribution/src/main/resources/conf/application.properties @@ -0,0 +1,3 @@ +zookeeper.connection.url=localhost:2199 +helix.cluster.name=AiravataDemoCluster +participant.name=all-p3 \ No newline at end of file diff --git a/modules/airavata-helix-distribution/src/main/resources/conf/cred_store.jks b/modules/airavata-helix-distribution/src/main/resources/conf/cred_store.jks new file mode 100644 index 0000000..aca0a04 Binary files /dev/null and b/modules/airavata-helix-distribution/src/main/resources/conf/cred_store.jks differ diff --git a/modules/airavata-helix-distribution/src/main/resources/conf/log4j.properties b/modules/airavata-helix-distribution/src/main/resources/conf/log4j.properties new file mode 100644 index 0000000..04aa72a --- /dev/null +++ b/modules/airavata-helix-distribution/src/main/resources/conf/log4j.properties @@ -0,0 +1,13 @@ +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=INFO, A1 + +log4j.category.org.apache.helix=WARN +log4j.category.org.apache.zookeeper=WARN +log4j.category.org.apache.airavata.helix.impl.task.submission.config.GroovyMapData=TRACE +log4j.category.org.apache.airavata.helix.impl.task.submission.JobSubmissionTask=DEBUG +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-4r [%t] [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}] %-5p %c %x - %m%n \ No newline at end of file diff --git a/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/participant/HelixParticipant.java b/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/participant/HelixParticipant.java index 503f5ca..a7e5a64 100644 --- a/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/participant/HelixParticipant.java +++ b/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/participant/HelixParticipant.java @@ -20,6 +20,7 @@ import org.apache.helix.task.TaskStateModelFactory; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; +import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.List; @@ -43,12 +44,16 @@ public class HelixParticipant <T extends AbstractTask> implements Runnable { private PropertyResolver propertyResolver; private Class<T> taskClass; - public HelixParticipant(String propertyFile, Class<T> taskClass, String taskTypeName) throws IOException { + public HelixParticipant(String propertyFile, Class<T> taskClass, String taskTypeName, boolean readPropertyFromFile) throws IOException { logger.info("Initializing Participant Node"); this.propertyResolver = new PropertyResolver(); - propertyResolver.loadInputStream(this.getClass().getClassLoader().getResourceAsStream(propertyFile)); + if (readPropertyFromFile) { + propertyResolver.loadFromFile(new File(propertyFile)); + } else { + propertyResolver.loadInputStream(this.getClass().getClassLoader().getResourceAsStream(propertyFile)); + } this.zkAddress = propertyResolver.get("zookeeper.connection.url"); this.clusterName = propertyResolver.get("helix.cluster.name"); diff --git a/modules/helix-spectator/pom.xml b/modules/helix-spectator/pom.xml index 326d7ef..5c36d2c 100644 --- a/modules/helix-spectator/pom.xml +++ b/modules/helix-spectator/pom.xml @@ -53,7 +53,7 @@ <dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-clients</artifactId> - <version>1.0.0</version> + <version>${kafka-clients.version}</version> </dependency> <dependency> <groupId>org.apache.airavata</groupId> diff --git a/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/controller/HelixController.java b/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/controller/HelixController.java similarity index 64% rename from modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/controller/HelixController.java rename to modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/controller/HelixController.java index cdc27f7..11d7129 100644 --- a/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/controller/HelixController.java +++ b/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/controller/HelixController.java @@ -1,10 +1,11 @@ -package org.apache.airavata.helix.core.controller; +package org.apache.airavata.helix.impl.controller; import org.apache.airavata.helix.core.util.PropertyResolver; import org.apache.helix.controller.HelixControllerMain; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; +import java.io.File; import java.io.IOException; import java.util.concurrent.CountDownLatch; @@ -26,10 +27,14 @@ public class HelixController implements Runnable { private CountDownLatch startLatch = new CountDownLatch(1); private CountDownLatch stopLatch = new CountDownLatch(1); - public HelixController(String propertyFile) throws IOException { + public HelixController(String propertyFile, boolean readPropertyFromFile) throws IOException { PropertyResolver propertyResolver = new PropertyResolver(); - propertyResolver.loadInputStream(this.getClass().getClassLoader().getResourceAsStream(propertyFile)); + if (readPropertyFromFile) { + propertyResolver.loadFromFile(new File(propertyFile)); + } else { + propertyResolver.loadInputStream(this.getClass().getClassLoader().getResourceAsStream(propertyFile)); + } this.clusterName = propertyResolver.get("helix.cluster.name"); this.controllerName = propertyResolver.get("helix.controller.name"); @@ -38,6 +43,9 @@ public class HelixController implements Runnable { public void run() { try { + logger.info("Connection to helix cluster : " + clusterName + " with name : " + controllerName); + logger.info("Zookeeper connection string " + zkAddress); + zkHelixManager = HelixControllerMain.startHelixController(zkAddress, clusterName, controllerName, HelixControllerMain.STANDALONE); startLatch.countDown(); @@ -82,10 +90,32 @@ public class HelixController implements Runnable { public static void main(String args[]) { try { - HelixController helixController = new HelixController("application.properties"); + + logger.info("Starting helix controller"); + String confDir = null; + if (args != null) { + for (String arg : args) { + if (arg.startsWith("--confDir=")) { + confDir = arg.substring("--confDir=".length()); + } + } + } + + String propertiesFile = "application.properties"; + boolean readPropertyFromFile = false; + + if (confDir != null && !confDir.isEmpty()) { + propertiesFile = confDir.endsWith(File.separator)? confDir + propertiesFile : confDir + File.separator + propertiesFile; + readPropertyFromFile = true; + } + + logger.info("Using configuration file " + propertiesFile); + + HelixController helixController = new HelixController(propertiesFile, readPropertyFromFile); helixController.start(); + } catch (IOException e) { - e.printStackTrace(); + logger.error("Failed to start the helix controller", e); } } } diff --git a/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/participant/GlobalParticipant.java b/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/participant/GlobalParticipant.java index 4849934..7dd5c99 100644 --- a/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/participant/GlobalParticipant.java +++ b/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/participant/GlobalParticipant.java @@ -7,13 +7,18 @@ import org.apache.airavata.helix.task.api.annotation.TaskDef; import org.apache.helix.task.Task; import org.apache.helix.task.TaskCallbackContext; import org.apache.helix.task.TaskFactory; +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; public class GlobalParticipant extends HelixParticipant { + private static final Logger logger = LogManager.getLogger(GlobalParticipant.class); + private String[] taskClasses = { "org.apache.airavata.helix.impl.task.env.EnvSetupTask", "org.apache.airavata.helix.impl.task.staging.InputDataStagingTask", @@ -52,17 +57,35 @@ public class GlobalParticipant extends HelixParticipant { e.printStackTrace(); } } - - return taskRegistry; } - public GlobalParticipant(String propertyFile, Class taskClass, String taskTypeName) throws IOException { - super(propertyFile, taskClass, taskTypeName); + public GlobalParticipant(String propertyFile, Class taskClass, String taskTypeName, boolean readPropertyFromFile) throws IOException { + super(propertyFile, taskClass, taskTypeName, readPropertyFromFile); } public static void main(String args[]) throws IOException { - GlobalParticipant participant = new GlobalParticipant("application.properties", null, null); + + String confDir = null; + if (args != null) { + for (String arg : args) { + if (arg.startsWith("--confDir=")) { + confDir = arg.substring("--confDir=".length()); + } + } + } + + String propertiesFile = "application.properties"; + boolean readPropertyFromFile = false; + + if (confDir != null && !confDir.isEmpty()) { + propertiesFile = confDir.endsWith(File.separator)? confDir + propertiesFile : confDir + File.separator + propertiesFile; + readPropertyFromFile = true; + } + + logger.info("Using configuration file " + propertiesFile); + + GlobalParticipant participant = new GlobalParticipant(propertiesFile, null, null, readPropertyFromFile); Thread t = new Thread(participant); t.start(); } diff --git a/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/TaskOnFailException.java b/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/TaskOnFailException.java index 196a219..1b24d77 100644 --- a/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/TaskOnFailException.java +++ b/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/TaskOnFailException.java @@ -2,7 +2,6 @@ package org.apache.airavata.helix.impl.task; public class TaskOnFailException extends Exception { - private String reason; private boolean critical; private Throwable e; diff --git a/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/submission/config/GroovyMapData.java b/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/submission/config/GroovyMapData.java index 5414a46..8c19763 100644 --- a/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/submission/config/GroovyMapData.java +++ b/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/submission/config/GroovyMapData.java @@ -447,14 +447,14 @@ public class GroovyMapData { String error = "Template file '" + templateName + "' not found"; throw new Exception(error); } - File template = new File(templateUrl.getPath()); + //File template = new File(templateUrl.getPath()); TemplateEngine engine = new GStringTemplateEngine(); Writable make; try { - make = engine.createTemplate(template).make(toImmutableMap()); + make = engine.createTemplate(templateUrl).make(toImmutableMap()); } catch (Exception e) { - throw new Exception("Error while generating script using groovy map"); + throw new Exception("Error while generating script using groovy map for template " + templateUrl.getPath(), e); } if (logger.isTraceEnabled()) { diff --git a/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/PostWorkflowManager.java b/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/PostWorkflowManager.java index b0de43a..225f81d 100644 --- a/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/PostWorkflowManager.java +++ b/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/PostWorkflowManager.java @@ -47,8 +47,8 @@ public class PostWorkflowManager { private static final Logger logger = LogManager.getLogger(PostWorkflowManager.class); - private final String BOOTSTRAP_SERVERS = "localhost:9092"; - private final String TOPIC = "parsed-data"; + //private final String BOOTSTRAP_SERVERS = "localhost:9092"; + //private final String TOPIC = "parsed-data"; private CuratorFramework curatorClient = null; private Publisher statusPublisher; @@ -59,16 +59,16 @@ public class PostWorkflowManager { this.curatorClient.start(); } - private Consumer<String, JobStatusResult> createConsumer() { + private Consumer<String, JobStatusResult> createConsumer() throws ApplicationSettingsException { final Properties props = new Properties(); - props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, BOOTSTRAP_SERVERS); - props.put(ConsumerConfig.GROUP_ID_CONFIG, "MonitoringConsumer"); + props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, ServerSettings.getSetting("kafka.broker.url")); + props.put(ConsumerConfig.GROUP_ID_CONFIG, ServerSettings.getSetting("kafka.broker.consumer.group")); props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JobStatusResultDeserializer.class.getName()); // Create the consumer using props. final Consumer<String, JobStatusResult> consumer = new KafkaConsumer<String, JobStatusResult>(props); // Subscribe to the topic. - consumer.subscribe(Collections.singletonList(TOPIC)); + consumer.subscribe(Collections.singletonList(ServerSettings.getSetting("kafka.broker.topic"))); return consumer; } @@ -184,8 +184,10 @@ public class PostWorkflowManager { } allTasks.add(completingTask); - WorkflowManager workflowManager = new WorkflowManager("AiravataDemoCluster", - "wm-23", ServerSettings.getZookeeperConnection()); + WorkflowManager workflowManager = new WorkflowManager( + ServerSettings.getSetting("helix.cluster.name"), + ServerSettings.getSetting("post.workflow.manager.name"), + ServerSettings.getZookeeperConnection()); workflowManager.launchWorkflow(processId + "-POST-" + UUID.randomUUID().toString(), allTasks.stream().map(t -> (AiravataTask) t).collect(Collectors.toList()), true, false); @@ -209,7 +211,7 @@ public class PostWorkflowManager { } } - private void runConsumer() throws InterruptedException { + private void runConsumer() throws ApplicationSettingsException { final Consumer<String, JobStatusResult> consumer = createConsumer(); while (true) { @@ -269,55 +271,5 @@ public class PostWorkflowManager { PostWorkflowManager postManager = new PostWorkflowManager(); postManager.init(); postManager.runConsumer(); - /* - String processId = "PROCESS_5b252ad9-d630-4cf9-80e3-0c30c55d1001"; - ExperimentCatalog experimentCatalog = RegistryFactory.getDefaultExpCatalog(); - - ProcessModel processModel = (ProcessModel) experimentCatalog.get(ExperimentCatalogModelType.PROCESS, processId); - ExperimentModel experimentModel = (ExperimentModel) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, processModel.getExperimentId()); - String taskDag = processModel.getTaskDag(); - List<TaskModel> taskList = processModel.getTasks(); - - String[] taskIds = taskDag.split(","); - final List<AiravataTask> allTasks = new ArrayList<>(); - - boolean jobSubmissionFound = false; - - for (String taskId : taskIds) { - Optional<TaskModel> model = taskList.stream().filter(taskModel -> taskModel.getTaskId().equals(taskId)).findFirst(); - - if (model.isPresent()) { - TaskModel taskModel = model.get(); - AiravataTask airavataTask = null; - if (taskModel.getTaskType() == TaskTypes.ENV_SETUP) { - //airavataTask = new EnvSetupTask(); - } else if (taskModel.getTaskType() == TaskTypes.JOB_SUBMISSION) { - //airavataTask = new DefaultJobSubmissionTask(); - //airavataTask.setRetryCount(1); - jobSubmissionFound = true; - } else if (taskModel.getTaskType() == TaskTypes.DATA_STAGING) { - if (jobSubmissionFound) { - airavataTask = new OutputDataStagingTask(); - } else { - //airavataTask = new InputDataStagingTask(); - } - } - - if (airavataTask != null) { - airavataTask.setGatewayId(experimentModel.getGatewayId()); - airavataTask.setExperimentId(experimentModel.getExperimentId()); - airavataTask.setProcessId(processModel.getProcessId()); - airavataTask.setTaskId(taskModel.getTaskId()); - if (allTasks.size() > 0) { - allTasks.get(allTasks.size() -1).setNextTask(new OutPort(airavataTask.getTaskId(), airavataTask)); - } - allTasks.add(airavataTask); - } - } - } - - WorkflowManager workflowManager = new WorkflowManager("AiravataDemoCluster", "wm-22", "localhost:2199"); - workflowManager.launchWorkflow(UUID.randomUUID().toString(), allTasks.stream().map(t -> (AiravataTask)t).collect(Collectors.toList()), true); - */ } } diff --git a/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/PreWorkflowManager.java b/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/PreWorkflowManager.java index ac29c9d..18a6627 100644 --- a/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/PreWorkflowManager.java +++ b/modules/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/PreWorkflowManager.java @@ -42,15 +42,6 @@ public class PreWorkflowManager { this.subscriber = MessagingFactory.getSubscriber(new ProcessLaunchMessageHandler(), routingKeys, Type.PROCESS_LAUNCH); } - public static void main(String[] args) throws Exception { - - PreWorkflowManager preWorkflowManager = new PreWorkflowManager(); - - //String processId = "PROCESS_5b252ad9-d630-4cf9-80e3-0c30c55d1001"; - //AppCatalog appCatalog = RegistryFactory.getAppCatalog(); - - } - private String createAndLaunchPreWorkflow(String processId, String gateway) throws Exception { ExperimentCatalog experimentCatalog = RegistryFactory.getExperimentCatalog(gateway); @@ -98,13 +89,19 @@ public class PreWorkflowManager { } } - WorkflowManager workflowManager = new WorkflowManager("AiravataDemoCluster", "wm-22", + WorkflowManager workflowManager = new WorkflowManager( + ServerSettings.getSetting("helix.cluster.name"), + ServerSettings.getSetting("post.workflow.manager.name"), ServerSettings.getZookeeperConnection()); String workflowName = workflowManager.launchWorkflow(processId + "-PRE-" + UUID.randomUUID().toString(), allTasks.stream().map(t -> (AiravataTask) t).collect(Collectors.toList()), true, false); return workflowName; } + public static void main(String[] args) throws Exception { + PreWorkflowManager preWorkflowManager = new PreWorkflowManager(); + } + private class ProcessLaunchMessageHandler implements MessageHandler { @Override diff --git a/modules/helix-spectator/src/main/resources/airavata-server.properties b/modules/helix-spectator/src/main/resources/airavata-server.properties index b54b28c..19b3b3d 100644 --- a/modules/helix-spectator/src/main/resources/airavata-server.properties +++ b/modules/helix-spectator/src/main/resources/airavata-server.properties @@ -260,13 +260,24 @@ email.based.monitor.store.protocol=imaps email.based.monitoring.period=10000 ########################################################################### +#Helix workflow manager configurations +########################################################################### + +kafka.broker.url=localhost:9092 +kafka.broker.topic=parsed-data +kafka.broker.consumer.group=MonitoringConsumer +helix.cluster.name=AiravataDemoCluster +pre.workflow.manager.name=prewm +post.workflow.manager.name=postwm + +########################################################################### # AMQP Notification Configuration ########################################################################### #for simple scenarios we can use the guest user #rabbitmq.broker.url=amqp://localhost:5672 #for production scenarios, give url as amqp://userName:password@hostName:portNumber/virtualHost, create user, virtualhost # and give permissions, refer: http://blog.dtzq.com/2012/06/rabbitmq-users-and-virtual-hosts.html -rabbitmq.broker.url=amqp://airavata:123456@192.168.99.102:5672/master +rabbitmq.broker.url=amqp://rabbit:rabbit123456@149.165.168.248:5672/master rabbitmq.status.exchange.name=status_exchange rabbitmq.process.exchange.name=process_exchange rabbitmq.experiment.exchange.name=experiment_exchange @@ -279,7 +290,7 @@ experiment.launch..queue.name=experiment.launch.queue # Zookeeper Server Configuration ########################################################################### embedded.zk=false -zookeeper.server.connection=192.168.99.102:2181 +zookeeper.server.connection=localhost:2199 zookeeper.timeout=30000 ######################################################################## diff --git a/pom.xml b/pom.xml index c8e72db..834afe7 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,7 @@ </prerequisites> <modules> <module>modules/job-monitor</module> + <module>modules/airavata-helix-distribution</module> </modules> <parent> @@ -115,7 +116,7 @@ <snakeyaml.version>1.15</snakeyaml.version> <maven.javadoc.failOnError>false</maven.javadoc.failOnError> <maven.replacer.plugin.version>1.5.3</maven.replacer.plugin.version> - <kafka-clients.version>0.8.2.2</kafka-clients.version> + <kafka-clients.version>1.0.0</kafka-clients.version> <logback.version>1.1.6</logback.version> <json.version>20160212</json.version> <commons.io.version>2.4</commons.io.version> @@ -701,6 +702,7 @@ <module>modules/compute-account-provisioning</module> <module>modules/airavata-helix</module> <module>modules/helix-spectator</module> + <module>modules/airavata-helix-distribution</module> </modules> </profile> <profile> -- To stop receiving notification emails like this one, please contact dimuthu...@apache.org.