Skip to content

Commit 883538e

Browse files
committed
Use configuration_name instead of cos_id
1 parent 3415449 commit 883538e

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

python/ibmos2spark/osconfig.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def url(self, container_name, object_name):
176176

177177
class CloudObjectStorage(object):
178178

179-
def __init__(self, sparkcontext, credentials, cos_id='', bucket_name=''):
179+
def __init__(self, sparkcontext, credentials, configuration_name='', bucket_name=''):
180180

181181
'''
182182
sparkcontext: a SparkContext object.
@@ -208,7 +208,7 @@ def __init__(self, sparkcontext, credentials, cos_id='', bucket_name=''):
208208
209209
'''
210210
self.bucket_name = bucket_name
211-
self.cos_id = cos_id
211+
self.conf_name = configuration_name
212212

213213
# check if all required values are availble
214214
credential_key_list = ["endpoint", "access_key", "secret_key"]
@@ -221,8 +221,8 @@ def __init__(self, sparkcontext, credentials, cos_id='', bucket_name=''):
221221
# setup config
222222
prefix = "fs.cos"
223223

224-
if (cos_id):
225-
prefix = "{}.{}".format(prefix, cos_id)
224+
if (configuration_name):
225+
prefix = "{}.{}".format(prefix, configuration_name)
226226
else:
227227
prefix = prefix + "." + DEFAULT_SERVICE_NAME
228228

@@ -231,9 +231,6 @@ def __init__(self, sparkcontext, credentials, cos_id='', bucket_name=''):
231231
hconf.set(prefix + ".access.key", credentials['access_key'])
232232
hconf.set(prefix + ".secret.key", credentials['secret_key'])
233233

234-
def get_os_id(self):
235-
return self.cos_id
236-
237234
def url(self, object_name, bucket_name=''):
238235
bucket_name_var = ''
239236
service_name = DEFAULT_SERVICE_NAME
@@ -247,7 +244,7 @@ def url(self, object_name, bucket_name=''):
247244
raise ValueError("Invalid input: bucket_name is required!")
248245

249246
# use service name that we set up hadoop config for
250-
if (self.cos_id):
251-
service_name = self.cos_id
247+
if (self.conf_name):
248+
service_name = self.conf_name
252249

253250
return "cos://{}.{}/{}".format(bucket_name_var, service_name, object_name)

0 commit comments

Comments
 (0)