spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kabeer Ahmed" <kab...@linuxmail.org>
Subject Re: Setting conf options in jupyter
Date Sun, 02 Oct 2016 22:55:25 GMT
<html><head></head><body><div style="font-family: Verdana;font-size:
12.0px;"><div>
<div>William:</div>

<div>&nbsp;</div>

<div>Try something based on the below lines. You should get rid of the error that you
have reported.</div>

<div>&nbsp;</div>

<div>HTH,</div>

<div>&nbsp;</div>

<div>scala&gt; sc.stop</div>

<div>&nbsp;</div>

<div>scala&gt; :paste</div>

<div>// Entering paste mode (ctrl-D to finish)</div>

<div>&nbsp;</div>

<div>import org.apache.spark._</div>

<div>val sc = new SparkContext(</div>

<div>&nbsp; &nbsp; &nbsp; new SparkConf().setAppName(&quot;bar&quot;)</div>

<div>&nbsp; &nbsp; &nbsp; )</div>

<div>&nbsp;
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px
solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Sent:</b>&nbsp;Thursday, September
29, 2016 at 9:23 PM<br/>
<b>From:</b>&nbsp;&quot;William Kupersanin&quot; &lt;wkupersa@gmail.com&gt;<br/>
<b>To:</b>&nbsp;user@spark.apache.org<br/>
<b>Subject:</b>&nbsp;Setting conf options in jupyter</div>

<div name="quoted-content">
<div>Hello,
<div>&nbsp;</div>

<div>I am trying to figure out how to correctly set config options in jupyter when I
am already provided a SparkContext and a HiveContext. I need to increase a couple of memory
allocations. My program dies indicating that I am trying to call methods on a stopped SparkContext.
I thought I had created a new one with the new conf so I am not sure why&nbsp;</div>

<div>&nbsp;</div>

<div>My code is as follows:</div>

<div>&nbsp;</div>

<div>from pyspark import SparkConf, SparkContext</div>

<div>
<div>from pyspark.sql import HiveContext</div>

<div>from pyspark.sql import SQLContext</div>

<div>conf = (SparkConf()</div>

<div>&nbsp; &nbsp; &nbsp; &nbsp; .set(&quot;spark.yarn.executor.memoryOverhead&quot;,
&quot;4096&quot;)</div>

<div>&nbsp; &nbsp; &nbsp; &nbsp;.set(&quot;spark.kryoserializer.buffer.max.mb&quot;,
&quot;1024&quot;))</div>

<div>&nbsp;</div>

<div>sc.stop()</div>

<div>sc = SparkContext(conf=conf)</div>

<div>sqlContext2 = SQLContext.getOrCreate(sc)</div>
</div>

<div>
<div>starttime = time.time()</div>

<div>sampledate = &quot;20160913&quot;</div>

<div>networkdf = sqlContext2.read.json(&quot;/sp/network/&quot; + sampledate
+ &quot;/03/*&quot;)</div>
</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>
<div>An error occurred while calling o144.json.</div>

<div>: java.lang.IllegalStateException: Cannot call methods on a stopped SparkContext.</div>

<div>This stopped SparkContext was created at:....</div>
</div>
</div>
</div>
</div>
</div>
</div></div></body></html>

---------------------------------------------------------------------
To unsubscribe e-mail: user-unsubscribe@spark.apache.org


Mime
View raw message