@@ -52,7 +52,7 @@ def __init__(self, ceUniqueID):
52
52
# Time left before proxy renewal: 3 hours is a good default
53
53
self .proxyTimeLeftBeforeRenewal = 10800
54
54
# Timeout
55
- self .arcRESTTimeout = 5.0
55
+ self .timeout = 5.0
56
56
# Request session
57
57
self .session = None
58
58
self .headers = {}
@@ -75,7 +75,14 @@ def _reset(self):
75
75
self .proxyTimeLeftBeforeRenewal = self .ceParameters .get (
76
76
"ProxyTimeLeftBeforeRenewal" , self .proxyTimeLeftBeforeRenewal
77
77
)
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 )
79
86
80
87
# Build the URL based on the CEName, the port and the REST version
81
88
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=
147
154
if not headers :
148
155
headers = self .headers
149
156
if not timeout :
150
- timeout = self .arcRESTTimeout
157
+ timeout = self .timeout
151
158
152
159
if method .upper () not in ["GET" , "POST" , "PUT" ]:
153
160
return S_ERROR ("The request method is unknown" )
@@ -165,7 +172,7 @@ def _request(self, method, query, params=None, data=None, headers=None, timeout=
165
172
return S_ERROR ("Response: %s - %s" % (response .status_code , response .reason ))
166
173
return S_OK (response )
167
174
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 )
169
176
except requests .ConnectionError as e :
170
177
return S_ERROR ("Connection failed, consider checking the state of the CE: %s" % e )
171
178
except requests .RequestException as e :
@@ -587,8 +594,8 @@ def _renewJobs(self, arcJobList):
587
594
)
588
595
continue
589
596
590
- self .log .debug ("Proxy successfully renewed" , "for job %s" % arcJob )
591
-
597
+ self .log .debug ("Proxy successfully renewed" , "for job %s" % arcJob )
598
+
592
599
return S_OK ()
593
600
594
601
#############################################################################
0 commit comments