Skip to content

Commit a5bedbf

Browse files
committed
fix: reschedule the correct job in JobAgent
1 parent 5d8c98c commit a5bedbf

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/DIRAC/WorkloadManagementSystem/Agent/JobAgent.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,8 @@ def _checkSubmittedJobs(self):
694694
submissionErrors = []
695695
payloadErrors = []
696696
originalJobID = self.jobReport.jobID
697-
for jobID, taskID in self.submissionDict.items():
697+
for jobID in list(self.submissionDict.keys()):
698+
taskID = self.submissionDict[jobID]
698699
if taskID not in self.computingElement.taskResults:
699700
continue
700701

@@ -731,7 +732,9 @@ def _checkSubmittedJobs(self):
731732
self.log.info(message)
732733

733734
# Remove taskID from computingElement.taskResults as it has been treated
735+
# Remove jobID from submissionDict as it has been treated
734736
del self.computingElement.taskResults[taskID]
737+
del self.submissionDict[jobID]
735738

736739
self.jobReport.setJob(originalJobID)
737740
return S_OK((submissionErrors, payloadErrors))

src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_JobAgent.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ def test_submitAndCheckJob(mocker, localCE, job, expectedResult1, expectedResult
517517
jobAgent.log = gLogger.getSubLogger("JobAgent")
518518
jobAgent._initializeComputingElement(localCE)
519519
jobAgent.jobReport = JobReport(jobID)
520+
jobAgent.jobSubmissionDelay = 3
520521

521522
# Submit a job
522523
result = jobAgent._submitJob(
@@ -547,10 +548,6 @@ def test_submitAndCheckJob(mocker, localCE, job, expectedResult1, expectedResult
547548
assert result["OK"]
548549
assert result["Value"] == expectedResult1
549550

550-
# Check that the job is still present in jobAgent.submissionDict
551-
assert len(jobAgent.submissionDict) == 1
552-
assert jobID in jobAgent.submissionDict
553-
554551
# If the submission is synchronous jobAgent.computingElement.taskResults
555552
# should not contain the result anymore: already processed by checkSubmittedJobs
556553
if not jobAgent.computingElement.ceParameters.get("AsyncSubmission", False):
@@ -576,7 +573,6 @@ def test_submitAndCheckJob(mocker, localCE, job, expectedResult1, expectedResult
576573
assert result["Value"] == expectedResult2
577574

578575
# From here, taskResults should be empty
579-
assert jobID in jobAgent.submissionDict
580576
assert len(jobAgent.computingElement.taskResults) == 0
581577

582578

0 commit comments

Comments
 (0)