@@ -110,8 +110,8 @@ def __init__(self, ceUniqueID):
110
110
#############################################################################
111
111
112
112
def _DiracToCondorID (self , diracJobID ):
113
- """Convert a DIRAC jobID into an Condor jobID.
114
- Example: https ://<ce>/1234/ 0 becomes 1234.0
113
+ """Convert a DIRAC jobID into a Condor jobID.
114
+ Example: htcondorce ://<ce>/1234. 0 becomes 1234.0
115
115
116
116
:param str: DIRAC jobID
117
117
:return: Condor jobID
@@ -128,7 +128,7 @@ def _condorToDiracID(self, condorJobIDs):
128
128
129
129
:param str condorJobIDs: the output of condor_submit
130
130
131
- :return: job references such as htcondorce://<CE name >/<clusterID>.<i>
131
+ :return: job references such as htcondorce://<ce >/<clusterID>.<i>
132
132
"""
133
133
clusterIDs = condorJobIDs .split ("-" )
134
134
if len (clusterIDs ) != 2 :
@@ -179,7 +179,6 @@ def __writeSub(self, executable, location, processors, pilotStamps, tokenFile=No
179
179
180
180
# Remote schedd options by default
181
181
targetUniverse = "vanilla"
182
- # This is used to remove outputs from the remote schedd
183
182
scheddOptions = ""
184
183
if self .useLocalSchedd :
185
184
targetUniverse = "grid"
@@ -227,7 +226,7 @@ def _executeCondorCommand(self, cmd, keepTokenFile=False):
227
226
228
227
:param list cmd: list of the condor command elements
229
228
:param bool keepTokenFile: flag to reuse or not the previously created token file
230
- :return: S_OK/S_ERROR - the result of the executeGridCommand() call
229
+ :return: S_OK/S_ERROR - the stdout parameter of the executeGridCommand() call
231
230
"""
232
231
if not self .token and not self .proxy :
233
232
return S_ERROR (f"Cannot execute the command, token and proxy not found: { cmd } " )
@@ -406,8 +405,7 @@ def getJobStatus(self, jobIDList):
406
405
# Get all condorIDs so we can just call condor_q and condor_history once
407
406
for diracJobID in jobIDList :
408
407
diracJobID = diracJobID .split (":::" )[0 ]
409
- condorJobID = self ._DiracToCondorID (diracJobID )
410
- condorIDs [diracJobID ] = condorJobID
408
+ condorIDs [diracJobID ] = self ._DiracToCondorID (diracJobID )
411
409
412
410
self .tokenFile = None
413
411
@@ -422,8 +420,7 @@ def getJobStatus(self, jobIDList):
422
420
if not result ["OK" ]:
423
421
return result
424
422
425
- _qList = result ["Value" ].split ("\n " )
426
- qList .extend (_qList )
423
+ qList .extend (result ["Value" ].split ("\n " ))
427
424
428
425
condorHistCall = ["condor_history" ]
429
426
condorHistCall .extend (self .remoteScheddOptions .strip ().split (" " ))
@@ -433,21 +430,15 @@ def getJobStatus(self, jobIDList):
433
430
if not result ["OK" ]:
434
431
return result
435
432
436
- _qList = result ["Value" ].split ("\n " )
437
- qList .extend (_qList )
433
+ qList .extend (result ["Value" ].split ("\n " ))
438
434
439
- jobsToCancel = []
440
435
for job , jobID in condorIDs .items ():
441
- pilotStatus , reason = parseCondorStatus (qList , jobID )
436
+ jobStatus , reason = parseCondorStatus (qList , jobID )
442
437
443
- if pilotStatus == PilotStatus .ABORTED :
444
- self .log .verbose ("Held job" , f"{ jobID } because: { reason } " )
445
- jobsToCancel .append (jobID )
438
+ if jobStatus == PilotStatus .ABORTED :
439
+ self .log .verbose ("Job" , f"{ jobID } held: { reason } " )
446
440
447
- resultDict [job ] = pilotStatus
448
-
449
- # Make sure the pilot stays dead and gets taken out of the condor_q
450
- self .killJob (jobsToCancel )
441
+ resultDict [job ] = jobStatus
451
442
452
443
self .tokenFile = None
453
444
@@ -480,7 +471,7 @@ def getJobOutput(self, jobID):
480
471
481
472
return S_OK ((result ["Value" ]["output" ], result ["Value" ]["error" ]))
482
473
483
- def _findFile (self , workingDir , fileName , pathToResult ):
474
+ def _findFile (self , fileName , pathToResult ):
484
475
"""Find a file in a file system.
485
476
486
477
:param str workingDir: the name of the directory containing the given file to search for
@@ -489,7 +480,7 @@ def _findFile(self, workingDir, fileName, pathToResult):
489
480
490
481
:return: path leading to the file
491
482
"""
492
- path = os .path .join (workingDir , pathToResult , fileName )
483
+ path = os .path .join (self . workingDirectory , pathToResult , fileName )
493
484
if os .path .exists (path ):
494
485
return S_OK (path )
495
486
return S_ERROR (errno .ENOENT , f"Could not find { path } " )
@@ -535,7 +526,7 @@ def __getJobOutput(self, jobID, outTypes):
535
526
outputsSuffix = {"output" : "out" , "error" : "err" , "logging" : "log" }
536
527
outputs = {}
537
528
for output , suffix in outputsSuffix .items ():
538
- resOut = self ._findFile (self . workingDirectory , f"{ condorJobID } .{ suffix } " , pathToResult )
529
+ resOut = self ._findFile (f"{ condorJobID } .{ suffix } " , pathToResult )
539
530
if not resOut ["OK" ]:
540
531
# Return an error if the output type was targeted, else we continue
541
532
if output in outTypes :
0 commit comments