Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Rename HttpServerShellCmdHandler whose typo was fixed previously

...

 

Code Block
languagebash
> java -cp lang/java/reef-examples/target/reef-examples-{$REEF_VERSION}-shaded.jar org.apache.reef.examples.hello.HelloREEFNoClient

The output should be the same to HelloREEF, with evaluator.stdout containing the “Hello, REEF!” message.

 

Running HelloREEF on YARN

REEF applications can be run on multiple runtime environments. Using HelloREEFYarn, we will see how to configure and launch REEF applications on YARN.


Prerequisites

You have compiled REEF locally, and have YARN installed and correctly configured.

How to configure REEF on YARN

The only difference between running a REEF application on YARN vs locally is the runtime configuration:

Code Block
languagejava
final LauncherStatus status = DriverLauncher
        .getLauncher(YarnClientConfiguration.CONF.build())
        .run(getDriverConfiguration(), JOB_TIMEOUT);

How to launch HelloREEFYarn

Running HelloREEFYarn is very similar to running HelloREEF:

Code Block
languagebash
> yarn jar lang/java/reef-examples/target/reef-examples-{$REEF_VERSION}-shaded.jar org.apache.reef.examples.hello.HelloREEFYarn

You can see how REEF applications work on YARN environments in Introduction to REEF.

 

Running a REEF Webserver: HelloREEFHttp

REEF also has a webserver interface to handle HTTP requests. This webserver can be utilized in many different manners such as in Interprocess Communcation or in conjuction with the REST API.

To demonstrate a possible use for this interface, HelloREEFHttp serves as a simple webserver to execute shell commands requested from user input. The first thing we should do is register a handler to receive the HTTP requests.

Prerequisites

Again, you have compiled REEF locally.

 

HttpServerShellCmdtHandler

HttpServerShellCmdHandler

HttpServerShellCmdtHandler implements HttpHandler but HttpServerShellCmdHandler implements HttpHandler but three methods must be overridden first: getUriSpecification, setUriSpecification, and onHttpRequest.

  •  UriSpecification defines the URI specification for the handler. More than one handler can exist per application and thus each handler is distinguished using this specification. Since HelloREEFHttp defines UriSpecification asCommand, an HTTP request looks like http://{host_address}:{host_port}/Command/{request}.
  • onHttpRequest defines a hook for when an HTTP request for this handler is invoked.