Skip to content

Commit 34ad066

Browse files
authored
Merge pull request #7332 from chaen/v9.0_HACK_23.11.30
[9.0] revive future JobMonitoringHandler and allow proxyLocation to work with host
2 parents 68cd8ca + c003267 commit 34ad066

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

src/DIRAC/Core/DISET/private/BaseClient.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,11 @@ def __discoverExtraCredentials(self):
253253
:return: S_OK()/S_ERROR()
254254
"""
255255
# which extra credentials to use?
256-
self.__extraCredentials = self.VAL_EXTRA_CREDENTIALS_HOST if self.__useCertificates else ""
256+
self.__extraCredentials = (
257+
self.VAL_EXTRA_CREDENTIALS_HOST
258+
if (self.__useCertificates and not self.kwargs.get(self.KW_PROXY_LOCATION))
259+
else ""
260+
)
257261
if self.KW_EXTRA_CREDENTIALS in self.kwargs:
258262
self.__extraCredentials = self.kwargs[self.KW_EXTRA_CREDENTIALS]
259263

src/DIRAC/Core/DISET/private/Transports/SSLTransport.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ def checkSanity(urlTuple, kwargs):
4040
"""
4141
useCerts = False
4242
certFile = ""
43-
if "useCertificates" in kwargs and kwargs["useCertificates"]:
43+
if kwargs.get("proxyLocation"):
44+
certFile = kwargs["proxyLocation"]
45+
elif "useCertificates" in kwargs and kwargs["useCertificates"]:
4446
certTuple = Locations.getHostCertificateAndKeyLocation()
4547
if not certTuple:
4648
gLogger.error("No cert/key found! ")
@@ -52,10 +54,7 @@ def checkSanity(urlTuple, kwargs):
5254
gLogger.error("proxyString parameter is not a valid type", str(type(kwargs["proxyString"])))
5355
return S_ERROR("proxyString parameter is not a valid type")
5456
else:
55-
if "proxyLocation" in kwargs:
56-
certFile = kwargs["proxyLocation"]
57-
else:
58-
certFile = Locations.getProxyLocation()
57+
certFile = Locations.getProxyLocation()
5958
if not certFile:
6059
gLogger.error("No proxy found")
6160
return S_ERROR("No proxy found")

src/DIRAC/Core/Tornado/Client/private/TornadoBaseClient.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def __discoverExtraCredentials(self):
277277
WARNING: COPY/PASTE FROM Core/Diset/private/BaseClient
278278
"""
279279
# which extra credentials to use?
280-
if self.__useCertificates:
280+
if self.__useCertificates and not self.kwargs.get(self.KW_PROXY_LOCATION):
281281
self.__extraCredentials = self.VAL_EXTRA_CREDENTIALS_HOST
282282
else:
283283
self.__extraCredentials = ""
@@ -508,10 +508,11 @@ def _request(self, retry=0, outputFile=None, **kwargs):
508508
return url
509509
url = url["Value"]
510510

511+
if self.kwargs.get(self.KW_PROXY_LOCATION):
512+
auth = {"cert": self.kwargs[self.KW_PROXY_LOCATION]}
511513
# getting certificate
512514
# Do we use the server certificate ?
513-
if self.kwargs[self.KW_USE_CERTIFICATES]:
514-
# TODO: make this code path work with DiracX for Agents and possibly webapp ?
515+
elif self.kwargs[self.KW_USE_CERTIFICATES]:
515516
auth = {"cert": Locations.getHostCertificateAndKeyLocation()}
516517

517518
# Use access token?
@@ -550,8 +551,6 @@ def _request(self, retry=0, outputFile=None, **kwargs):
550551
fp = os.fdopen(tmpHandle, "w")
551552
fp.write(self.kwargs[self.KW_PROXY_STRING])
552553
fp.close()
553-
elif self.kwargs.get(self.KW_PROXY_LOCATION):
554-
auth = {"cert": self.kwargs[self.KW_PROXY_LOCATION]}
555554
else:
556555
auth = {"cert": Locations.getProxyLocation()}
557556
if not auth["cert"]:

src/DIRAC/WorkloadManagementSystem/FutureClient/JobMonitoringClient.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
from diracx.client import DiracClient
2-
3-
41
from DIRAC.Core.Utilities.ReturnValues import convertToReturnValue
52

3+
from DIRAC.Core.Security.DiracX import DiracXClient
4+
65

76
class JobMonitoringClient:
87
def fetch(self, parameters, jobIDs):
9-
with DiracClient() as api:
8+
with DiracXClient() as api:
109
jobs = api.jobs.search(
1110
parameters=["JobID"] + parameters,
1211
search=[{"parameter": "JobID", "operator": "in", "values": jobIDs}],

0 commit comments

Comments
 (0)