Skip to content

Commit 0101ea7

Browse files
committed
Protocols: user overides config set timeout from func call rucio#7351
1 parent a1eeafb commit 0101ea7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/rucio/rse/protocols/webdav.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,16 @@ def get(self, pfn, dest='.', transfer_timeout=None):
259259
260260
:param pfn: Physical file name of requested file
261261
:param dest: Name and path of the files when stored at the client
262-
:param transfer_timeout: Transfer timeout (in seconds) - dummy
262+
:param transfer_timeout: Transfer timeout (in seconds)
263263
264264
:raises DestinationNotAccessible, ServiceUnavailable, SourceNotFound, RSEAccessDenied
265265
"""
266266
path = self.path2pfn(pfn)
267267
chunksize = 1024
268+
transfer_timeout = self.timeout if transfer_timeout is None else transfer_timeout
269+
268270
try:
269-
result = self.session.get(path, verify=False, stream=True, timeout=self.timeout, cert=self.cert)
271+
result = self.session.get(path, verify=False, stream=True, timeout=transfer_timeout, cert=self.cert)
270272
if result and result.status_code in [200, ]:
271273
length = None
272274
if 'content-length' in result.headers:
@@ -297,19 +299,21 @@ def put(self, source, target, source_dir=None, transfer_timeout=None, progressba
297299
:param source: Physical file name
298300
:param target: Name of the file on the storage system e.g. with prefixed scope
299301
:param source_dir Path where the to be transferred files are stored in the local file system
300-
:param transfer_timeout Transfer timeout (in seconds) - dummy
302+
:param transfer_timeout Transfer timeout (in seconds)
301303
302304
:raises DestinationNotAccessible, ServiceUnavailable, SourceNotFound, RSEAccessDenied
303305
"""
304306
path = self.path2pfn(target)
305307
full_name = source_dir + '/' + source if source_dir else source
306308
directories = path.split('/')
307309
# Try the upload without testing the existence of the destination directory
310+
transfer_timeout = self.timeout if transfer_timeout is None else transfer_timeout
311+
308312
try:
309313
if not os.path.exists(full_name):
310314
raise exception.SourceNotFound()
311315
it = UploadInChunks(full_name, 10000000, progressbar)
312-
result = self.session.put(path, data=IterableToFileAdapter(it), verify=False, allow_redirects=True, timeout=self.timeout, cert=self.cert)
316+
result = self.session.put(path, data=IterableToFileAdapter(it), verify=False, allow_redirects=True, timeout=transfer_timeout, cert=self.cert)
313317
if result.status_code in [200, 201]:
314318
return
315319
if result.status_code in [409, ]:
@@ -323,7 +327,7 @@ def put(self, source, target, source_dir=None, transfer_timeout=None, progressba
323327
if not os.path.exists(full_name):
324328
raise exception.SourceNotFound()
325329
it = UploadInChunks(full_name, 10000000, progressbar)
326-
result = self.session.put(path, data=IterableToFileAdapter(it), verify=False, allow_redirects=True, timeout=self.timeout, cert=self.cert)
330+
result = self.session.put(path, data=IterableToFileAdapter(it), verify=False, allow_redirects=True, timeout=transfer_timeout, cert=self.cert)
327331
if result.status_code in [200, 201]:
328332
return
329333
if result.status_code in [409, ]:

0 commit comments

Comments
 (0)