Skip to content

Commit a11a505

Browse files
author
Robin VAN DE MERGHEL
committed
fix: Few fixes, and removed pilot logs related features
1 parent beaa171 commit a11a505

File tree

8 files changed

+10
-187
lines changed

8 files changed

+10
-187
lines changed

src/DIRAC/Core/Tornado/Client/ClientSelector.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,12 @@ def ClientSelector(disetClient, *args, **kwargs): # We use same interface as RP
6666
# If we are not already given a URL, resolve it
6767
if serviceName.startswith(("http", "dip")):
6868
completeUrl = serviceName
69-
elif useLegacyAdapter(serviceName) and diracxClient is not None:
70-
return diracxClient()
7169
else:
72-
if diracxClient:
70+
isServiceLegacyAdapted = useLegacyAdapter(serviceName)
71+
72+
if isServiceLegacyAdapted and diracxClient is not None:
73+
return diracxClient()
74+
elif isServiceLegacyAdapted:
7375
# Only warn to deactivate it without making the code crash.
7476
sLog.warn("DiracX is enabled but no diracxClient is provided, do you need to update your client?")
7577

src/DIRAC/Interfaces/API/DiracAdmin.py

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -368,63 +368,6 @@ def getJobPilotOutput(self, jobID, directory=""):
368368
self.log.always(f"Outputs retrieved in {outputPath}")
369369
return result
370370

371-
#############################################################################
372-
def getPilotOutput(self, gridReference, directory=""):
373-
"""Retrieve the pilot output (std.out and std.err) for an existing pilot reference.
374-
375-
>>> gLogger.notice(dirac.getJobPilotOutput(12345))
376-
{'OK': True, 'Value': {}}
377-
378-
:param str gridReference: pilot reference
379-
:param str directory: a directory to download logs to.
380-
:return: S_OK,S_ERROR
381-
"""
382-
if not isinstance(gridReference, str):
383-
return self._errorReport("Expected string for pilot reference")
384-
385-
if not directory:
386-
directory = self.currentDir
387-
388-
if not os.path.exists(directory):
389-
return self._errorReport(f"Directory {directory} does not exist")
390-
391-
result = PilotManagerClient().getPilotOutput(gridReference)
392-
if not result["OK"]:
393-
return result
394-
395-
gridReferenceSmall = gridReference.split("/")[-1]
396-
if not gridReferenceSmall:
397-
gridReferenceSmall = "reference"
398-
outputPath = f"{directory}/pilot_{gridReferenceSmall}"
399-
400-
if os.path.exists(outputPath):
401-
self.log.info(f"Remove {outputPath} and retry to continue")
402-
return S_ERROR(f"Remove {outputPath} and retry to continue")
403-
404-
if not os.path.exists(outputPath):
405-
self.log.verbose(f"Creating directory {outputPath}")
406-
os.mkdir(outputPath)
407-
408-
outputs = result["Value"]
409-
if "StdOut" in outputs:
410-
stdout = f"{outputPath}/std.out"
411-
with open(stdout, "w") as fopen:
412-
fopen.write(outputs["StdOut"])
413-
self.log.info(f"Standard output written to {stdout}")
414-
else:
415-
self.log.warn("No standard output returned")
416-
417-
if "StdErr" in outputs:
418-
stderr = f"{outputPath}/std.err"
419-
with open(stderr, "w") as fopen:
420-
fopen.write(outputs["StdErr"])
421-
self.log.info(f"Standard error written to {stderr}")
422-
else:
423-
self.log.warn("No standard error returned")
424-
425-
self.log.always(f"Outputs retrieved in {outputPath}")
426-
return result
427-
428371
#############################################################################
429372
def getPilotInfo(self, gridReference):
430373
"""Retrieve info relative to a pilot reference
@@ -478,22 +421,6 @@ def killPilot(self, gridReference):
478421

479422
return killPilotsInQueues(pilotRefDict)
480423

481-
#############################################################################
482-
def getPilotLoggingInfo(self, gridReference):
483-
"""Retrieve the pilot logging info for an existing job in the WMS.
484-
485-
>>> gLogger.notice(dirac.getPilotLoggingInfo(12345))
486-
{'OK': True, 'Value': {"The output of the command"}}
487-
488-
:param gridReference: Gridp pilot job reference Id
489-
:type gridReference: string
490-
:return: S_OK,S_ERROR
491-
"""
492-
if not isinstance(gridReference, str):
493-
return self._errorReport("Expected string for pilot reference")
494-
495-
return PilotManagerClient().getPilotLoggingInfo(gridReference)
496-
497424
#############################################################################
498425
def getJobPilots(self, jobID):
499426
"""Extract the list of submitted pilots and their status for a given

src/DIRAC/Interfaces/scripts/dirac_admin_get_pilot_logging_info.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/DIRAC/Interfaces/scripts/dirac_admin_get_pilot_output.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/DIRAC/WorkloadManagementSystem/Service/PilotManagerHandler.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import datetime
55
import shutil
66

7+
from DIRAC.Core.Utilities.Decorators import deprecated
78
import DIRAC.Core.Utilities.TimeUtilities as TimeUtilities
89
from DIRAC import S_ERROR, S_OK
910
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
@@ -41,6 +42,7 @@ def initializeHandler(cls, serviceInfoDict):
4142

4243
types_getPilotOutput = [str]
4344

45+
@deprecated("Rewritten in DiracX")
4446
def export_getPilotOutput(self, pilotReference):
4547
"""
4648
Get the pilot job standard output and standard error files for a pilot reference.
@@ -169,6 +171,7 @@ def _getRemotePilotOutput(self, pilotReference, pilotDict):
169171
##############################################################################
170172
types_getPilotLoggingInfo = [str]
171173

174+
@deprecated("Rewritten in DiracX")
172175
def export_getPilotLoggingInfo(self, pilotReference):
173176
"""Get the pilot logging info for the Grid job reference"""
174177
result = self.pilotAgentsDB.getPilotInfo(pilotReference)

src/DIRAC/WorkloadManagementSystem/Service/WMSAdministratorHandler.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,6 @@ def export_getJobPilotOutput(self, jobID):
178178
pilotReference = res["Value"][cycle]["Pilot_Reference"]
179179
c = cycle
180180

181-
if pilotReference:
182-
return self.pilotManager.getPilotOutput(pilotReference)
183181
return S_ERROR("No pilot job reference found")
184182

185183

tests/Integration/WorkloadManagementSystem/Test_PilotsClient.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ def test_PilotsDB():
4646
assert res["Value"]["anotherPilot"]["AccountingSent"] == "False"
4747
assert res["Value"]["anotherPilot"]["PilotJobReference"] == "anotherPilot"
4848

49-
# >>> TODO: Implement me
50-
# res = pilots.getPilotSummary("", "")
49+
# res = pilots.getPilotSummary("", "") # Did not understand this one
5150
# assert res["OK"], res["Message"]
5251
# assert res["Value"]["Total"]["Submitted"] >= 1
5352

tests/Jenkins/dirac-cfg-setup-diracx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def main(url: str, disabled_vos: list[str], legacy_adapted_services: list[str]):
7878
for service in legacy_adapted_services:
7979
print(f"Adding legacy adaptor for service {service}")
8080
# Service name such as: system/name
81-
system, name = service.split(" ")
81+
system, name = service.split("/")
8282

8383
if not system in legacy["LegacyClientEnabled"]:
8484
legacy["LegacyClientEnabled"][system] = {}

0 commit comments

Comments
 (0)