From ba3d5e5dcf1c26a4d339be04619436c79daafd58 Mon Sep 17 00:00:00 2001 From: Marco Lotz Date: Mon, 19 Sep 2016 17:15:48 +0100 Subject: [PATCH] DO NOT MERGE: fixed path and environment variables references for monanas Change-Id: I772756a0eb052bea7ff790e7f13f932dc40a32c6 --- doc/examples.md | 8 ++++---- run.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/examples.md b/doc/examples.md index ea3f0bc..b8fbff5 100644 --- a/doc/examples.md +++ b/doc/examples.md @@ -24,7 +24,7 @@ To test this example, perform the following steps. #### Configuration File Before running MoNanas, we need to create a configuration file describing how -we want MoNanas to orchestrate the data execution (creating a pipeline). You can find the following configuration in `$HOME/config/markov_source_config.json`: +we want MoNanas to orchestrate the data execution (creating a pipeline). You can find the following configuration in `$MONANAS_HOME/config/markov_source_config.json`: ```json @@ -174,7 +174,7 @@ $KAFKA_HOME/bin/kafka-server-start.sh \ After that, start MoNanas as follows. ```bash -python $MONANAS_HOME/run.py -p $SPARK_HOME -c $HOME/tmp/alert_example.json \ +python $MONANAS_HOME/run.py -p $SPARK_HOME -c $MONANAS_HOME/config/markov_source_config.json \ -l $MONANAS_HOME/config/logging.json ``` @@ -276,7 +276,7 @@ To test this example, perform the following steps. #### Configuration File Before running MoNanas, we need to create a configuration file describing how -we want MoNanas to orchestrate the data execution (creating a pipeline). You can find the following configuration in `$HOME/config/iptables_anomalies.json`: +we want MoNanas to orchestrate the data execution (creating a pipeline). You can find the following configuration in `$MONANAS_HOME/config/iptables_anomalies.json`: ```json { @@ -349,7 +349,7 @@ As you can see, the flow described in the previous section is mapped to the conf Start MoNanas as follows: ```bash -python $MONANAS_HOME/run.py -p $SPARK_HOME -c $HOME/config/iptables_anomalies.json \ +python $MONANAS_HOME/run.py -p $SPARK_HOME -c $MONANAS_HOME/config/iptables_anomalies.json \ -l $MONANAS_HOME/config/logging.json ``` If you want to run your own configuration you will need to change the value of the -c parameter. diff --git a/run.py b/run.py index f17ea32..43c919f 100644 --- a/run.py +++ b/run.py @@ -60,6 +60,7 @@ class RunnerError(Exception): def main(arguments): spark_submit = "{0}/bin/spark-submit".format(arguments[""]) + monanas_path = os.environ.get('MONANAS_HOME', "") kafka_jar = None try: @@ -79,7 +80,7 @@ def main(arguments): format(arguments[""], kafka_jar) command = [ spark_submit, "--master", "local[2]", - "--jars", spark_kafka_jar, "monasca_analytics/monanas.py", + "--jars", spark_kafka_jar, monanas_path + "/monasca_analytics/monanas.py", arguments[""], arguments[""] ] command += arguments[""]