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

radanalyticsio/tutorial-sparkpi-python-flask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

SparkPi

A python implementation of SparkPi using Flask as an HTTP interface

This application is an example tutorial for the radanalytics.io community. It is intended to be used as a source-to-image 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 sparkpi

    oc new-app --template oshinko-python-spark-build-dc  \
        -p APPLICATION_NAME=sparkpi \
        -p GIT_URI=https://github.com/radanalyticsio/tutorial-sparkpi-python-flask.git
  3. Expose an external route

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

    $ curl http://`oc get routes/sparkpi --template='{{.spec.host}}'`
    Python Flask SparkPi server running. Add the 'sparkpi' route to this URL to invoke the app.
    
    $ curl http://`oc get routes/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/sparkpi --template='{{.spec.host}}'`/sparkpi?scale=10
Pi is roughly 3.141749

About

a Python implementation of SparkPi using Flask

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages