Git Product home page Git Product logo

sparkstreamingapps's Introduction

TL;DR

The spark streaming API used in this repo boils down to the following snippet which demonstrates how an RDD has multiple Tweets in it (in this case, the tweets may have medical content, and that this blueprint implements a CTakes medical term extraction from an ongoing twitter stream, which uses the CTakes lexicon). But in any case, the thing to note is that RDDs of tweets have multiple tweets in them, so you have a nested processing loop, where in we (1) forEachRDD and (2) forEachTweet in the RDD.


    tweetStream.foreachRDD( transactions => {
        CassandraConnector(conf).withSessionDo {
        session => {
          val x=1
          Thread.sleep(1)
          transactions.foreach({
            xN =>
              System.out.println("Running Cassandra Insert..." + xN)
              System.out.println("Note that this can fail if cassandra isnt working...")
              val xNtxt=xN.toString+" "+xN.getText;
              session.executeAsync(s"INSERT INTO streaming_test.key_value (key, value) VALUES ('$xNtxt' , $x)")
          })
        }
      }
    })

How to use this Repo

I used this as my Demonstration at apachecon a few years ago to show how to build spark streaming apps.

This repo has two different resources.

  • testing of spark docker containers, orchestrated via vagrant.
  • spark streaming blueprint applications.

If interested just in the docker containers, checkout the deploy/ directory.

These are mostly unrelated. They just happen to be in the same repo.

Spark Streaming Blueprint apps.

To use it, import it into INtelliJ or your favorite IDE as an SBT project.

Then you should be able to run standard SBT tests/compile tasks etc inside your idea and also in standalone mode.

  1. git clone jayunit100/SparkBluePrint

  2. remove folders that dont apply to your project.

  3. Now open intellij, and import.

  4. Pick "SBT" project as the template

  5. Run the Tester class via intelliJ

  6. Change the .git/config to point to your repository.

Running in a real cluster

  • Set up a spark cluster w/ cassandra slaves. There is a WIP project under deploy/ which sets scaffolding for this up using dockerfiles and vagrant to create a n-node spark cluster w/ a cassandra sink.

  • Then run sbt package, to create the jar.

  • copy the jar into the shared directory defined in the vagrantfile in deploy (in general, just copy the file into your machine that submits the spark jobs).

  • spark-submit the application jar w/ desired class name (details coming soon).

Feedback welcome !

sparkstreamingapps's People

Contributors

jayunit100 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sparkstreamingapps's Issues

Error on start vagrant-run-up-test.sh

A Docker command executed by Vagrant didn't complete successfully!
The command run along with the output from the command is shown
below.

Command: ["docker", "run", "--name", "scale2", "-d", "-v", "/home/stefano/SparkStreamingApps/deploy:/scale-shared", "-v", "/home/stefano/SparkStreamingApps/deploy:/vagrant", "-h", "scale2.docker", "--privileged=true", "--link", "scale1:scale1.docker", "--link", "cassandra1:cassandra1.docker", "839deaeff2fb", {:notify=>[:stdout, :stderr]}]

Stderr: time="2015-02-08T18:29:01+01:00" level="fatal" msg="Error response from daemon: Cannot start container be5adb9fdc63d53c0bffdc33414bcf71b10d540dca317d78f0335a90a7bb9dbe: Cannot link to a non running container: /scale1 AS /scale2/scale1.docker"

Stdout: be5adb9fdc63d53c0bffdc33414bcf71b10d540dca317d78f0335a90a7bb9dbe

RUNNING smoke tests...
FATA[0000] Error response from daemon: Container scale1 is not running

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.