Skip to content

Commit 8fd7389

Browse files
authored
Merge pull request #8282 from chrisburr/fix-sandbox-and-run-local
Fix sandbox and run local
2 parents f2dc3d2 + 102717e commit 8fd7389

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
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

src/DIRAC/WorkloadManagementSystem/Client/SandboxStoreClient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def ZstdCompatibleTarFile(tarFileName: os.PathLike, *, mode: Literal["r"] = "r")
3434
# Read magic bytes to determine compression format
3535
if magic.startswith(b"\x28\xb5\x2f\xfd"): # zstd magic number
3636
dctx = zstandard.ZstdDecompressor()
37-
with dctx.stream_reader(f) as decompressor:
37+
with open(tarFileName, "rb") as f, dctx.stream_reader(f) as decompressor:
3838
with tarfile.open(fileobj=decompressor, mode=f"{mode}|") as tf:
3939
yield tf
4040
else:

0 commit comments

Comments
 (0)