Skip to content

Commit 7705305

Browse files
authored
Merge pull request #8156 from fstagni/90_killPilotsList
fix: can kill a list of pilots
2 parents 6a5067f + c307a29 commit 7705305

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/DIRAC/Interfaces/API/DiracAdmin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@ def killPilot(self, gridReference):
449449
:param gridReference: Pilot Job Reference
450450
:return: S_OK,S_ERROR
451451
"""
452-
if not isinstance(gridReference, str):
453-
return self._errorReport("Expected string for pilot reference")
452+
if not isinstance(gridReference, (str, list)):
453+
return self._errorReport("Expected string or list of strings for pilot reference")
454454

455455
result = PilotManagerClient().killPilot(gridReference)
456456
return result

src/DIRAC/WorkloadManagementSystem/Service/PilotManagerHandler.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,16 +339,15 @@ def export_getPilots(cls, jobID):
339339
def export_killPilot(cls, pilotRefList):
340340
"""Kill the specified pilots"""
341341
# Make a list if it is not yet
342-
pilotRefs = list(pilotRefList)
343342
if isinstance(pilotRefList, str):
344-
pilotRefs = [pilotRefList]
343+
pilotRefList = [pilotRefList]
345344

346345
# Regroup pilots per site
347346
pilotRefDict = {}
348-
for pilotReference in pilotRefs:
347+
for pilotReference in pilotRefList:
349348
result = cls.pilotAgentsDB.getPilotInfo(pilotReference)
350349
if not result["OK"] or not result["Value"]:
351-
return S_ERROR("Failed to get info for pilot " + pilotReference)
350+
return S_ERROR(f"Failed to get info for pilot {pilotReference}")
352351

353352
pilotDict = result["Value"][pilotReference]
354353
queue = "@@@".join(

0 commit comments

Comments
 (0)