Skip to content

Commit 48e7ff6

Browse files
Robin VAN DE MERGHELRobin-Van-de-Merghel
authored andcommitted
fix: Few fixes, and removed pilot logs related features
1 parent 596815d commit 48e7ff6

File tree

6 files changed

+4
-183
lines changed

6 files changed

+4
-183
lines changed

src/DIRAC/Interfaces/API/DiracAdmin.py

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

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

491434
return killPilotsInQueues(pilotRefDict)
492435

493-
#############################################################################
494-
def getPilotLoggingInfo(self, gridReference):
495-
"""Retrieve the pilot logging info for an existing job in the WMS.
496-
497-
>>> gLogger.notice(dirac.getPilotLoggingInfo(12345))
498-
{'OK': True, 'Value': {"The output of the command"}}
499-
500-
:param gridReference: Gridp pilot job reference Id
501-
:type gridReference: string
502-
:return: S_OK,S_ERROR
503-
"""
504-
if not isinstance(gridReference, str):
505-
return self._errorReport("Expected string for pilot reference")
506-
507-
return PilotManagerClient().getPilotLoggingInfo(gridReference)
508-
509436
#############################################################################
510437
def getJobPilots(self, jobID):
511438
"""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

0 commit comments

Comments
 (0)