如何更改Interactive PySpark会议SparkContext性能 [英] How to change SparkContext properties in Interactive PySpark session

查看:340
本文介绍了如何更改Interactive PySpark会议SparkContext性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能改变spark.driver.maxResultSize在pyspark交互shell?我用下面的code

 从pyspark进口SparkConf,SparkContext
CONF =(SparkConf()
    .SET(spark.driver.maxResultSize,10克))
sc.stop()
SC = SparkContext(CONF)

但它给我的错误

  AttributeError的:SparkConf'对象有没有属性'_get_object_id


解决方案

所以你看到的是什么样的 SparkConf 是不是一个Java对象,这种情况正在发生,因为它的尝试使用 SparkConf 作为第一个参数,如果不是你做的 SC = SparkContext(CONF = CONF)应该使用您的配置。话虽这么说,你可能是刚开始一个普通的Python程序,而不是停止默认情况下火花功放和更好;重新启动它,但你需要使用命名参数技术在conf对象传递两种方式。

How can I change spark.driver.maxResultSize in pyspark interactive shell? I have used the following code

from pyspark import SparkConf, SparkContext
conf = (SparkConf()
    .set("spark.driver.maxResultSize", "10g"))
sc.stop()
sc=SparkContext(conf)

but it gives me the error

AttributeError: 'SparkConf' object has no attribute '_get_object_id'

解决方案

So what your seeing is that the SparkConf isn't a java object, this is happening because its trying to use the SparkConf as the first parameter, if instead you do sc=SparkContext(conf=conf) it should use your configuration. That being said, you might be better of just starting a regular python program rather than stopping the default spark context & re-starting it, but you'll need to use the named parameter technique to pass in the conf object either way.

这篇关于如何更改Interactive PySpark会议SparkContext性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆