From 94e270c6eb7045a52b987e67277ff8577599bc70 Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Thu, 12 Sep 2024 16:17:02 +0200 Subject: [PATCH] fix: added a 30s gfal2 timeout for downloading the SRR --- .../Storage/OccupancyPlugins/WLCGAccountingJson.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/DIRAC/Resources/Storage/OccupancyPlugins/WLCGAccountingJson.py b/src/DIRAC/Resources/Storage/OccupancyPlugins/WLCGAccountingJson.py index 30e794b046a..8f3c277e0dc 100644 --- a/src/DIRAC/Resources/Storage/OccupancyPlugins/WLCGAccountingJson.py +++ b/src/DIRAC/Resources/Storage/OccupancyPlugins/WLCGAccountingJson.py @@ -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: @@ -43,7 +45,8 @@ def _downloadJsonFile(self, occupancyLFN, filePath): 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) # Just make sure the file is json, and not SSO HTML with open(filePath) as f: json.load(f)