Re: passing SparkContext as parameter
can i use this sparkContext on executors ?? In my application, i have scenario of reading from db for certain records in rdd. Hence I need sparkContext to read from DB (cassandra in our case), If sparkContext couldn't be sent to executors , what is the workaround for this ?? On Mon, Sep 21, 2015 at 3:06 PM, Petr Novakwrote: > add @transient? > > On Mon, Sep 21, 2015 at 11:27 AM, Priya Ch > wrote: > >> Hello All, >> >> How can i pass sparkContext as a parameter to a method in an object. >> Because passing sparkContext is giving me TaskNotSerializable Exception. >> >> How can i achieve this ? >> >> Thanks, >> Padma Ch >> > >
Re: passing SparkContext as parameter
sparkConext is available on the driver, not on executors. To read from Cassandra, you can use something like this: https://github.com/datastax/spark-cassandra-connector/blob/master/doc/2_loading.md *Romi Kuntsman*, *Big Data Engineer* http://www.totango.com On Mon, Sep 21, 2015 at 2:27 PM, Priya Chwrote: > can i use this sparkContext on executors ?? > In my application, i have scenario of reading from db for certain records > in rdd. Hence I need sparkContext to read from DB (cassandra in our case), > > If sparkContext couldn't be sent to executors , what is the workaround for > this ?? > > On Mon, Sep 21, 2015 at 3:06 PM, Petr Novak wrote: > >> add @transient? >> >> On Mon, Sep 21, 2015 at 11:27 AM, Priya Ch >> wrote: >> >>> Hello All, >>> >>> How can i pass sparkContext as a parameter to a method in an object. >>> Because passing sparkContext is giving me TaskNotSerializable Exception. >>> >>> How can i achieve this ? >>> >>> Thanks, >>> Padma Ch >>> >> >> >
Re: passing SparkContext as parameter
You can use broadcast variable for passing connection information. Cheers > On Sep 21, 2015, at 4:27 AM, Priya Chwrote: > > can i use this sparkContext on executors ?? > In my application, i have scenario of reading from db for certain records in > rdd. Hence I need sparkContext to read from DB (cassandra in our case), > > If sparkContext couldn't be sent to executors , what is the workaround for > this ?? > >> On Mon, Sep 21, 2015 at 3:06 PM, Petr Novak wrote: >> add @transient? >> >>> On Mon, Sep 21, 2015 at 11:27 AM, Priya Ch >>> wrote: >>> Hello All, >>> >>> How can i pass sparkContext as a parameter to a method in an object. >>> Because passing sparkContext is giving me TaskNotSerializable Exception. >>> >>> How can i achieve this ? >>> >>> Thanks, >>> Padma Ch >