Skip to content

Commit f338b02

Browse files
authored
Merge pull request #8247 from aldbr/v9.0_FIX_condor-spool
feat(resources): spool SSH+Condor job inputs/outputs
2 parents db28585 + a7d8c80 commit f338b02

File tree

1 file changed

+22
-3
lines changed
  • src/DIRAC/Resources/Computing/BatchSystems

1 file changed

+22
-3
lines changed

src/DIRAC/Resources/Computing/BatchSystems/Condor.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def submitJob(self, **kwargs):
167167
jdlFile.flush()
168168

169169
cmd = "%s; " % preamble if preamble else ""
170-
cmd += "condor_submit %s" % jdlFile.name
170+
cmd += "condor_submit -spool %s" % jdlFile.name
171171
sp = subprocess.Popen(
172172
cmd,
173173
shell=True,
@@ -286,10 +286,12 @@ def getJobStatus(self, **kwargs):
286286
output, error = sp.communicate()
287287
status = sp.returncode
288288

289-
if status != 0 or not output:
289+
if status != 0:
290290
resultDict["Status"] = status
291291
resultDict["Message"] = error
292292
return resultDict
293+
if not output:
294+
output = "[]"
293295

294296
jobsMetadata = json.loads(output)
295297

@@ -304,10 +306,12 @@ def getJobStatus(self, **kwargs):
304306
output, _ = sp.communicate()
305307
status = sp.returncode
306308

307-
if status != 0 or not output:
309+
if status != 0:
308310
resultDict["Status"] = status
309311
resultDict["Message"] = error
310312
return resultDict
313+
if not output:
314+
output = "[]"
311315

312316
jobsMetadata += json.loads(output)
313317

@@ -399,6 +403,21 @@ def getJobOutputFiles(self, **kwargs):
399403
jobDict = {}
400404
for jobID in jobIDList:
401405
jobDict[jobID] = {}
406+
407+
cmd = "condor_transfer_data %s" % jobID
408+
sp = subprocess.Popen(
409+
shlex.split(cmd),
410+
stdout=subprocess.PIPE,
411+
stderr=subprocess.PIPE,
412+
universal_newlines=True,
413+
)
414+
_, error = sp.communicate()
415+
status = sp.returncode
416+
if status != 0:
417+
resultDict["Status"] = -1
418+
resultDict["Message"] = error
419+
return resultDict
420+
402421
jobDict[jobID]["Output"] = "%s/%s.out" % (outputDir, jobID)
403422
jobDict[jobID]["Error"] = "%s/%s.err" % (errorDir, jobID)
404423

0 commit comments

Comments
 (0)