2016-08-03 11 views
0

Apache sparkデータ分析の設定手順を試すと、このエラーが発生します。IBM Bluemix set_hadoop_configエラー

アウト

credentials['name'] = 'keystone' 
set_hadoop_config(credentials) 

def set_hadoop_config(credentials): 
    prefix = "fs.swift.service." + credentials['name'] 
    hconf = sc._jsc.hadoopConfiguration() 
    hconf.set(prefix + ".auth.url", credentials['auth_url']+'/v3/auth/tokens') 
    hconf.set(prefix + ".auth.endpoint.prefix", "endpoints") 
    hconf.set(prefix + ".tenant", credentials['project_id']) 
    hconf.set(prefix + ".username", credentials['user_id']) 
    hconf.set(prefix + ".password", credentials['password']) 
    hconf.setInt(prefix + ".http.port", 8080) 
    hconf.set(prefix + ".region", credentials['region']) 
    hconf.setBoolean(prefix + ".public", True) 

--------------------------------------------------------------------------- 
NameError         Traceback (most recent call last) 
<ipython-input-6-976c35e1d85e> in <module>() 
----> 1 credentials['name'] = 'keystone' 
     2 set_hadoop_config(credentials) 

NameError: name 'credentials' is not defined 

誰もがこの問題を解決する方法を知っていますか?私立ち往生

答えて

1

午前私はあなたが以下のようにオブジェクトストアのサービスへのアクセスのパラメータの値を渡す必要があり、すなわち、資格情報が辞書欠けていると思う:

credentials = 
{ 
    'auth_uri':'', 
    'global_account_auth_uri':'', 
    'username':'admin_b055482b7febbd287d9020d65cdd55f5653d0ffb', 
    'password':"XXXXXX", 
    'auth_url':'https://identity.open.softlayer.com', 
    'project':'object_storage_e5e45537_ea14_4d15_b90a_5fdd271ea402', 
    'project_id':'7d7e5f2a83fe47e586b91f459d47169f', 
    'region':'dallas', 
    'user_id':'001c394e06d74b86a76a786615e358e2', 
    'domain_id':'2df6373c549e49f8973fb6d22ab18c1a', 
    'domain_name':'639347', 
    'filename':'2015_SQL.csv', 
    'container':'notebooks', 
    'tenantId':'s322-e1e9acad6196b9-a1259eb961e2' 
} 

あなたはノートブックを使用している場合は、上記を得ることができますデータソースパネル(右側)の下にリストされているファイルに「コードに挿入」を使用します。

は、次のようにスウィフトURIが必要になり、ファイルにアクセスするには:

raw_data = sc.textFile("swift://" + credentials['container'] + "." + credentials['name'] + "/" + credentials['filename']) 
+0

感謝を!あなたは私がこの問題を解決するのを手助けしました。 –

関連する問題