Search code examples
apache-sparkcassandrah2odl4j

Spark Machine learning design model from web application


I have developed a web application where user can choose machine learning framework/ number of iterations/ some other tuning parameter. How can I invoke Spark job from user interface by passing all the inputs and display response to user. Depending on the framework (dl4j/ spark mllib/ H2o) user can either upload input csv or the data can be read from Cassandra.

  1. How can I call SPARK job from user interface?
  2. How can I display the result back to user?

Please help.


Solution

  • You can take a look at this github repository.

    In this what is being done is as soon as a GET request is arrived, it takes out the data from the Cassandra and then Collect the data and throws it back as the response.

    So in your case :

    What you can do is , as soon as you recieve a POST request , you can get the parameters from the request and perform the operations accordingly using these parameters and the collect the Result on the master and then throw it back to the user as the Response.

    P.S: Collecting on Master is a bit tricky and lot of data can cause OOM. What you can do is save the results on hadoop and send back the URL to the Results or something like that.

    For more info look into this blog related to this github: https://blog.knoldus.com/2016/10/12/cassandra-with-spark/