Skip to content

Commit 102717e

Browse files
committed
feat: add sandbox download functionality in Dirac runLocal API
1 parent fabcf03 commit 102717e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/DIRAC/Interfaces/API/Dirac.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,14 @@ def runLocal(self, job):
422422
sandbox = [isFile.strip() for isFile in sandbox.split(",")]
423423
for isFile in sandbox:
424424
self.log.debug(f"Resolving Input Sandbox {isFile}")
425+
# If the sandbox is already in the sandbox store, download it
426+
if isFile.startswith("SB:"):
427+
result = SandboxStoreClient(useCertificates=self.useCertificates).downloadSandbox(
428+
isFile, destinationDir=os.getcwd()
429+
)
430+
if not result["OK"]:
431+
return S_ERROR(f"Cannot download Input sandbox {isFile}: {result['Message']}")
432+
continue
425433
if isFile.lower().startswith("lfn:"): # isFile is an LFN
426434
isFile = isFile[4:]
427435
# Attempt to copy into job working directory, unless it is already there

src/DIRAC/Interfaces/API/Job.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,7 @@ def _toJDL(self, xmlFile="", jobDescriptionObject=None):
11051105
uniqueInputSandbox = uniqueElements(finalInputSandbox.split(";"))
11061106
paramsDict["InputSandbox"]["value"] = ";".join(uniqueInputSandbox)
11071107
self.log.verbose(f"Final unique Input Sandbox {';'.join(uniqueInputSandbox)}")
1108+
paramsDict["InputSandbox"]["type"] = "JDL"
11081109
else:
11091110
paramsDict["InputSandbox"] = {}
11101111
paramsDict["InputSandbox"]["value"] = extraFiles

0 commit comments

Comments
 (0)