Giter Site home page Giter Site logo

erikerlandson / openshift-jupyter-scala Goto Github PK

View Code? Open in Web Editor NEW
4.0 5.0 1.0 10 KB

A Dockerfile to build a jupyter-scala image runnable on OpenShift

License: Apache License 2.0

Dockerfile 100.00%
openshift scala jupyter jupyter-notebook ammonite

openshift-jupyter-scala's Introduction

openshift-jupyter-scala

Build

% cd /path/to/openshift-jupyter-scala
% docker build -t registry/openshift-jupyter-scala:latest .
% docker push registry/openshift-jupyter-scala:latest

Run in OpenShift

oc run jupyter-scala --image=registry/openshift-jupyter-scala:latest --expose --port=8888

Image may take a couple minutes for OpenShift to pull down.

Next, create a route for the jupyter-scala service. You should be able to open this route in your browser and get the Jupyter home-page, including a Scala kernel option.

This image defaults the jupyter password to just 'jupyter'. If you want to set another password you can configure the JUPYTER_NOTEBOOK_PASSWORD environment variable on your pod.

The image is based on the radanalytics.io base notebook image base-notebook

The latest rev of this image is based on the jupyter-scala project, which is now being packaged as almond on the develop branch. It is built on top of the ammonite Scala REPL.

In order to take advantage of the spark release pre-installed on this image, you need to get spark's jar files onto the ammonite classpath. This can be done by putting the following code on the first cell of your notebook:

// put the spark install from the base notebook image onto Ammonite's classpath
java.nio.file.Files.list(java.nio.file.Paths.get("/opt/spark/jars")).toArray.map(_.toString).foreach { fname =>
  val path = java.nio.file.FileSystems.getDefault().getPath(fname)
  val x = ammonite.ops.Path(path)
  interp.load.cp(x)
}
// Load the ammonite-spark package to get AmmoniteSparkSession
import $ivy.`sh.almond::ammonite-spark:0.1.1`

An example of connecting to a spark cluster using the AmmoniteSparkSession wrapper:

import org.apache.spark.sql._
val spark = {
    AmmoniteSparkSession.builder()
      .master("local[*]")
      .getOrCreate()
  }

Other examples of how to use this kernel can be found here.

openshift-jupyter-scala's People

Contributors

erikerlandson avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

jseteny

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.