@Pradhuman
Gupta
Apache Spark cannot do that out of the box.
But
you might be looking for is somemiddlewarethat can interface with Apache
Spark and run, submit and manage jobs for you.
Livy - REST
server with extensive language support (Python, R, Scala), ability to maintain
interactive sessions and object sharing.
spark-jobserver -
A simple Spark as a Service which supports objects sharing using so called
named objects. JVM only.
Mist -
A service for exposing Spark analytical jobs and machine learning models as
realtime, batch or reactive web services.
Apache Toree -
IPython protocol based middleware for interactive applications.
Hortonworks recommends Livy.
Also, read the last comment at: https://issues.apache.org/jira/browse/SPARK-2243
allowMultipleContexts has a very limited use for test only
and can lead to the error you see.