Prerequisites
You have compiled REEF locally.
The beginning of this tutorial is now managed on the [Apache Wiki](https://cwiki.apache.org/confluence/display/REEF/Compiling+REEF)
Running your first REEF program: Hello, REEF!
The module REEF Examples in the folder `reef-examples` contains several simple programs built on REEF to help you get started with development. As always, the simplest of those is our "Hello World": Hello REEF. Upon launch, it grabs a single Evaluator and submits a single Task to it. That Actvity, fittingly, prints 'Hello REEF!' to stdout. To launch it:
> cd reef-examples
> mvn -PHelloREEF
This invokes the profile `HelloREEF` in the maven build which launches HelloREEF on the local runtime of REEF. During the run, you will see something similar to this output:
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building REEF Examples 0.10-incubating-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
...
Powered by
___________ ______ ______ _______
/ ______ / / ___/ / ___/ / ____/
/ _____/ / /__ / /__ / /___
/ /\ \ / ___/ / ___/ / ____/
/ / \ \ / /__ / /__ / /
/__/ \__\ /_____/ /_____/ /__/
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
Where's the output?
The local runtime simulates a cluster of machines: It executes each Evaluator in a separate process on your machine. Hence, the Evaluator that printed "Hello, REEF" is not executed in the same process as the program you launched above. So, how do you get to the output of the Evaluator? The local runtime creates one folder per job it executes in a configurable root folder. In our builds, these folders are generated in the `target` folder of the maven build:
> cd target
> ls Hello*
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 8/2/2013 3:25 PM HelloREEF-1375482338468
The job folder names are comprised of the job's name (here, `HelloREEF`) and the time stamp of its submission (here, `1375482338468`). If you submit the same job multiple times, you will get multiple folders here. Let's move on:
> cd HelloREEF-1375482338468
> ls
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 8/2/2013 3:25 PM driver
d---- 8/2/2013 3:25 PM Node-1-1375482339266
Inside of the job's folder, you will find one folder for the job's Driver (named `driver`) and one per Evaluator. Their name comprises of the virtual node simulated by the local runtime (here, `Node-1`) followed by the time stamp of when this Evaluator was allocated on that node, here `1375482339266`. As the HelloREEF example program only allocated one Evaluator, we only see one of these folders here. Let's peek inside:
> cd Node-1-1375482339266
> ls *.txt
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2013-11-18 13:20 3 PID.txt
-a--- 2013-11-18 13:20 18911 STDERR.txt
-a--- 2013-11-18 13:20 3044 STDOUT.txt
STDERR.txt contains the output on stderr of this Evaluator, which mostly consists of logs helpful in debugging. `STDOUT.txt` contains the output on stdout. And, sure enough, this is where you find the "Hello, REEF!" message.