From 968bc9ad2a1799015ef899609933efba4e2f2004 Mon Sep 17 00:00:00 2001 From: Janusz Martyniak Date: Fri, 21 Jul 2023 15:19:08 +0200 Subject: [PATCH] feat: add remote log option download by JobID to dirac-admin tools --- src/DIRAC/Interfaces/API/DiracAdmin.py | 4 ++-- .../scripts/dirac_admin_get_job_pilot_output.py | 9 +++++++-- .../Interfaces/scripts/dirac_admin_get_pilot_output.py | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/DIRAC/Interfaces/API/DiracAdmin.py b/src/DIRAC/Interfaces/API/DiracAdmin.py index 07fd1ba9119..106793f0edd 100755 --- a/src/DIRAC/Interfaces/API/DiracAdmin.py +++ b/src/DIRAC/Interfaces/API/DiracAdmin.py @@ -451,7 +451,7 @@ def getJobPilotOutput(self, jobID, directory="", remote=False): if not os.path.exists(directory): return self._errorReport(f"Directory {directory} does not exist") - result = WMSAdministratorClient().getJobPilotOutput(jobID) + result = WMSAdministratorClient().getJobPilotOutput(jobID, remote) if not result["OK"]: return result @@ -511,7 +511,7 @@ def getPilotOutput(self, gridReference, directory="", remote=False): # get remote pilot logs: result = PilotManagerClient().getRemotePilotOutput(gridReference) else: - # get classic pilot log files from CE + # get classic pilot log files from a CE result = PilotManagerClient().getPilotOutput(gridReference) if not result["OK"]: diff --git a/src/DIRAC/Interfaces/scripts/dirac_admin_get_job_pilot_output.py b/src/DIRAC/Interfaces/scripts/dirac_admin_get_job_pilot_output.py index c24d6e6e350..9db8c061d21 100755 --- a/src/DIRAC/Interfaces/scripts/dirac_admin_get_job_pilot_output.py +++ b/src/DIRAC/Interfaces/scripts/dirac_admin_get_job_pilot_output.py @@ -16,8 +16,9 @@ def main(): # Registering arguments will automatically add their description to the help menu Script.registerArgument(["JobID: DIRAC ID of the Job"]) + Script.registerSwitch("r", "", "get remote pilot output") # parseCommandLine show help when mandatory arguments are not specified or incorrect argument - _, args = Script.parseCommandLine(ignoreErrors=True) + switches, args = Script.parseCommandLine(ignoreErrors=True) from DIRAC import exit as DIRACExit from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin @@ -26,6 +27,10 @@ def main(): exitCode = 0 errorList = [] + remote = False + if ("r", "") in switches: + remote = True + for job in args: try: job = int(job) @@ -34,7 +39,7 @@ def main(): exitCode = 2 continue - result = diracAdmin.getJobPilotOutput(job) + result = diracAdmin.getJobPilotOutput(job, remote=remote) if not result["OK"]: errorList.append((job, result["Message"])) exitCode = 2 diff --git a/src/DIRAC/Interfaces/scripts/dirac_admin_get_pilot_output.py b/src/DIRAC/Interfaces/scripts/dirac_admin_get_pilot_output.py index 9b415f86022..08b4dc21f4c 100755 --- a/src/DIRAC/Interfaces/scripts/dirac_admin_get_pilot_output.py +++ b/src/DIRAC/Interfaces/scripts/dirac_admin_get_pilot_output.py @@ -18,7 +18,7 @@ def main(): # Registering arguments will automatically add their description to the help menu Script.registerArgument(["PilotID: Grid ID of the pilot"]) - Script.registerSwitch("r", "", "get remote pilot output") + Script.registerSwitch("r", "", "Get remote pilot output") switches, args = Script.parseCommandLine(ignoreErrors=True) from DIRAC import exit as DIRACExit