Skip to content

Getting Started With EclairJS Server

Bill Reed edited this page Oct 3, 2016 · 2 revisions

The purpose of EclairJS Server is to expose the Apache Spark programming model to JavaScript. It consists of an interpreter which instantiates Nashorn, resolves Spark Java method references and initiates code evaluation and also a Java wrapper which, along with Nashorn, execute lambda functions and handle type conversions on Worker nodes.

EclairJS Server can be used independently from EclairJS Client.

Build the Server JAR as specified in the README. Once built, you can use the server JAR in the following three ways:

Using the EclairJS Server Jar

  1. As mentioned in the README on the main page you can use the eclairjs.sh script to:
  • Run a simple example to count words:
bin/eclairjs.ah examples/word_count.js

or

  • To enter REPL mode:
bin/eclairjs.sh
eclairJS>var conf = new SparkConf().setAppName("Sample App").setMaster("local[*]");
var sparkContext = new SparkContext(conf);
  1. If you are comfortable with using notebooks, you can follow the section on Usage with Jupyter Notebooks in the README for this project to start to explore the EclairJS Server API and work with Apache Spark through JavaScript.

  2. Finally, you can use the EclairJS Server Jar with EclairJS Client, the other component to EclairJS.