Skip to content

Instantly share code, notes, and snippets.

@gadamc
Created October 9, 2017 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gadamc/6284fe9b0cb42d8af0c0943f02b2c1cd to your computer and use it in GitHub Desktop.
Save gadamc/6284fe9b0cb42d8af0c0943f02b2c1cd to your computer and use it in GitHub Desktop.
import ibmos2spark
credentials = {
'auth_url': 'https://identity.open.softlayer.com', #your URL might be different
'project_id': '',
'region': '',
'user_id': '',
'username': '',
'password': '',
}
configuration_name = 'my_bluemix_os' #you can give any name you like
# 1. Create a connection
bmos = ibmos2spark.bluemix(sc, credentials, configuration_name) #sc is the SparkContext instance
# 2. Get path to data
path_to_data = bmos.url(container_name, object_name)
# Creat an Apache Spark RDD with path to data
data = sc.textFile(path_to_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment