Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0] fix: added a 30s gfal2 timeout for downloading the SRR #7787

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _downloadJsonFile(self, occupancyLFN, filePath):
with open(filePath, "w") as fd:
caPath = getCAsLocation()
userProxy = getProxyLocation()
res = requests.get(occupancyLFN, cert=userProxy, verify=caPath)
res = requests.get(occupancyLFN, cert=userProxy, verify=caPath, timeout=30)
res.raise_for_status()
fd.write(res.text)
except Exception as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@

When this is used, the OccupancyLFN has to be the full path on the storage, and not just the LFN
"""
import errno
import json
import os
import tempfile
import shutil
import errno
import tempfile

import gfal2 # pylint: disable=import-error

from DIRAC import S_OK, S_ERROR
from DIRAC import S_ERROR, S_OK
from DIRAC.Resources.Storage.GFAL2_StorageBase import setGfalSetting


class WLCGAccountingJson:
Expand All @@ -39,11 +41,13 @@ def _downloadJsonFile(self, occupancyLFN, filePath):
ctx = gfal2.creat_context()
params = ctx.transfer_parameters()
params.overwrite = True
params.timeout = 30
res = storage.updateURL(occupancyLFN)
if not res["OK"]:
continue
occupancyURL = res["Value"]
ctx.filecopy(params, occupancyURL, "file://" + filePath)
with setGfalSetting(ctx, "HTTP PLUGIN", "OPERATION_TIMEOUT", 30):
ctx.filecopy(params, occupancyURL, "file://" + filePath)
fstagni marked this conversation as resolved.
Show resolved Hide resolved
# Just make sure the file is json, and not SSO HTML
with open(filePath) as f:
json.load(f)
Expand Down
Loading