Running InsightEdge IDE Examples


This section explains how to use the sample code that has been provided with the InsightEdge package.

  • The example sources are located at $GS_HOME/insightedge/examples.

  • The example .jar file is located at $GS_HOME/insightedge/examples/jars.

Building the Examples

Building the examples is not required, since the package includes a pre-built .jar file. However, if you want to modify the examples for learning purposes and rebuild them, follow this procedure.

Before the first time building the examples, you need to install the InsightEdge artifacts in your local Maven repository. To do that, run the following from the $GS_HOME/bin/ directory:

gs.{sh/bat} maven install

Next, use the following command in Maven to build the examples from $GS_HOME/insightedge/examples:

mvn clean package

The end result is an examples .jar located at $GS_HOME/insightedge/examples/target/insightedge-examples.jar.

Running the Examples

In order to run the examples on your local machine you need to start a local InsightEdge environment. If you haven't done so already, refer to Starting InsightEdge on a Local Service Grid for more info.

You can run the InsightEdge example .jar from any of the following:

  • Apache Zeppelin Web Notebook

  • IDE

  • Command line

Using the Web Notebook

To run the examples from the Apache Zeppelin web notebook, go to http://localhost:9090/.

For more information, see the Using the InsightEdge Web Notebook page.

Using an IDE

You can run the examples from your preferred IDE. Every example has a main method, so it can be executed as standard application. Note these two important configuration requirements:

  • Enable run-from-ide in the Maven profile. This will switch the required dependencies to compile scope, so they are available in the classpath.

  • Pass the examples as local[*] and demo arguments.

Using a Command Line

To run the examples from a command line, run the following from the $GS_HOME/insightedge/bin directory:

insightedge-submit --class {main class name} --master {Spark master URL} {path/to/insightedge-examples.jar}

For example, SaveRDD can be submitted with the following syntax:

insightedge-submit --class org.insightedge.examples.basic.SaveRdd --master spark:// \

Running the TwitterPopularTags example requires you to pass Twitter app tokens as arguments.

Python Examples

In addition to the above, you can run Python examples using the following command:

insightedge-submit --master {Spark master URL} {path/to/}

For example:

insightedge-submit --master spark:// ./$GS_HOME/insightedge/examples/python/