Skip to content

Commit ae69af7

Browse files
committed
feat (wms): replace RESTARCTimeout by Timeout in AREXCE
1 parent 82d8fbc commit ae69af7

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/DIRAC/Resources/Computing/AREXComputingElement.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(self, ceUniqueID):
5252
# Time left before proxy renewal: 3 hours is a good default
5353
self.proxyTimeLeftBeforeRenewal = 10800
5454
# Timeout
55-
self.arcRESTTimeout = 5.0
55+
self.timeout = 5.0
5656
# Request session
5757
self.session = None
5858
self.headers = {}
@@ -75,7 +75,14 @@ def _reset(self):
7575
self.proxyTimeLeftBeforeRenewal = self.ceParameters.get(
7676
"ProxyTimeLeftBeforeRenewal", self.proxyTimeLeftBeforeRenewal
7777
)
78-
self.arcRESTTimeout = float(self.ceParameters.get("ARCRESTTimeout", self.arcRESTTimeout))
78+
79+
timeout = self.ceParameters.get("Timeout")
80+
if not timeout:
81+
timeout = self.ceParameters.get("ARCRESTTimeout")
82+
if timeout:
83+
self.log.warn("'ARCRESTTimeout' is deprecated, please use 'Timeout' instead.")
84+
if timeout:
85+
self.timeout = float(timeout)
7986

8087
# Build the URL based on the CEName, the port and the REST version
8188
service_url = os.path.join("https://", "%s:%s" % (self.ceName, self.port))
@@ -147,7 +154,7 @@ def _request(self, method, query, params=None, data=None, headers=None, timeout=
147154
if not headers:
148155
headers = self.headers
149156
if not timeout:
150-
timeout = self.arcRESTTimeout
157+
timeout = self.timeout
151158

152159
if method.upper() not in ["GET", "POST", "PUT"]:
153160
return S_ERROR("The request method is unknown")
@@ -165,7 +172,7 @@ def _request(self, method, query, params=None, data=None, headers=None, timeout=
165172
return S_ERROR("Response: %s - %s" % (response.status_code, response.reason))
166173
return S_OK(response)
167174
except requests.Timeout as e:
168-
return S_ERROR("Request timed out, consider increasing RESTARCTimeout: %s" % e)
175+
return S_ERROR("Request timed out, consider increasing the Timeout value: %s" % e)
169176
except requests.ConnectionError as e:
170177
return S_ERROR("Connection failed, consider checking the state of the CE: %s" % e)
171178
except requests.RequestException as e:
@@ -587,8 +594,8 @@ def _renewJobs(self, arcJobList):
587594
)
588595
continue
589596

590-
self.log.debug("Proxy successfully renewed", "for job %s" % arcJob)
591-
597+
self.log.debug("Proxy successfully renewed", "for job %s" % arcJob)
598+
592599
return S_OK()
593600

594601
#############################################################################

0 commit comments

Comments
 (0)