简体   繁体   English

未定义IBM Bluemix sc

[英]IBM Bluemix sc not defined

I am getting the following error when I try to run one of the samples that is given for the Apache Spark service on IBM Bluemix: 当我尝试在IBM Bluemix上运行为Apache Spark服务提供的示例之一时,出现以下错误:

NameErrorTraceback (most recent call last)
<ipython-input-5-7de9805c358e> in <module>()
----> 1 set_hadoop_config(credentials_1)

<ipython-input-2-e790e4773aec> in set_hadoop_config(credentials)
      1 def set_hadoop_config(credentials):
      2     prefix = "fs.swift.service." + credentials['name']
----> 3     hconf = sc._jsc.hadoopConfiguration()
      4     hconf.set(prefix + ".auth.url", credentials['auth_url']+'/v3/auth/tokens')
      5     hconf.set(prefix + ".auth.endpoint.prefix", "endpoints")

NameError: global name 'sc' is not defined

I am loading a simple CSV file using the insert to code options on the data sources palette. 我正在使用数据源面板上的插入代码选项加载一个简单的CSV文件。 However, the credentials that are generated do not have the 'name' attribute in it. 但是,生成的凭据中没有'name'属性。

credentials['name'] is not in the key value pairs that are generated after I click on insert to code. 单击我的代码插入后生成的键值对中没有credentials['name']

I want to know if there is any other way to load the data or this issue an IBM Bluemix issue. 我想知道是否还有其他方法可以加载数据,或者是否存在IBM Bluemix问题。

You were hit by a Bluemix issue. 您被Bluemix问题打中了。 The sc variable is defined by default, holding a SparkContext. 默认情况下定义sc变量,其中保留一个SparkContext。 But if the Spark master is not reachable when the Python notebook kernel starts, you'll notice a delay of several seconds, then the kernel comes up but sc is undefined. 但是,如果Python笔记本内核启动时Spark master无法访问,您会注意到延迟了几秒钟,则内核启动了,但是sc是未定义的。 Your queston is already two days old (was it missing one of the tags?), so things should have recovered by now. 您的任务已经有两天了(它是否缺少标签之一?),所以事情应该已经恢复了。 Just give it another try. 请再试一次。 If it fails, restart the kernel. 如果失败,请重新启动内核。 If you still got no sc , contact Bluemix support about an issue with the Apache Spark service. 如果仍然没有sc ,请联系Bluemix支持以解决Apache Spark服务的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM