Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

radanalyticsio/tutorial-sparkpi-java-vertx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

vertx-sparkpi

A Java implementation of SparkPi using Vert.x 3

This application is an example tutorial for the radanalytics.io community. It is intended to be used as a source-to-image (s2i) application.

Quick start

You should have access to an OpenShift cluster and be logged in with the oc command line tool.

  1. Create the necessary infrastructure objects

    oc create -f https://radanalytics.io/resources.yaml
  2. Launch vertx-sparkpi

    oc new-app --template oshinko-java-spark-build-dc \
        -p APPLICATION_NAME=vertx-sparkpi \
        -p GIT_URI=https://github.com/radanalyticsio/tutorial-sparkpi-java-vertx \
        -p APP_FILE=sparkpi-app-1.0-SNAPSHOT-vertx.jar \
        -p SPARK_OPTIONS='--driver-java-options="-Dvertx.cacheDirBase=/tmp/vertx-cache"'
  3. Expose an external route

    oc expose svc/vertx-sparkpi
  4. Visit the exposed URL with your browser or other HTTP tool, for example:

    $ curl http://`oc get routes/vertx-sparkpi --template='{{.spec.host}}'`
    Java Vert.x SparkPi server running. Add the 'sparkpi' route to this URL to invoke the app.
    
    $ curl http://`oc get routes/vertx-sparkpi --template='{{.spec.host}}'`/sparkpi
    Pi is roughly 3.140480

Optional parameter

If you would like to change the number of samples that are used to calculate Pi, you can specify them by adding the scale argument to your request , for example:

$ curl http://`oc get routes/vertx-sparkpi --template='{{.spec.host}}'`/sparkpi?scale=10
Pi is roughly 3.141749

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages