Skip to content

Commit

Permalink
feat: add remote log option download by JobID to dirac-admin tools
Browse files Browse the repository at this point in the history
  • Loading branch information
martynia committed Jul 25, 2023
1 parent d72d9d1 commit 5079df4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/DIRAC/Interfaces/API/DiracAdmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5079df4

Please sign in to comment.