From 84c6c02c9e174151b4367ddada3d0cd807d3fa79 Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Thu, 27 Jun 2024 11:33:15 +0200 Subject: [PATCH] sweep: #7701 JobDB: update LastUpdateTime when the job is matched --- src/DIRAC/Core/Utilities/TimeUtilities.py | 4 +--- .../Agent/StalledJobAgent.py | 14 +++++++------- .../WorkloadManagementSystem/Client/Matcher.py | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/DIRAC/Core/Utilities/TimeUtilities.py b/src/DIRAC/Core/Utilities/TimeUtilities.py index 4ffa926a11d..6dc969008c9 100755 --- a/src/DIRAC/Core/Utilities/TimeUtilities.py +++ b/src/DIRAC/Core/Utilities/TimeUtilities.py @@ -19,14 +19,12 @@ if a give datetime is in the defined interval. """ -import calendar -import time import datetime import sys +import time from DIRAC import gLogger - # Some useful constants for time operations microsecond = datetime.timedelta(microseconds=1) second = datetime.timedelta(seconds=1) diff --git a/src/DIRAC/WorkloadManagementSystem/Agent/StalledJobAgent.py b/src/DIRAC/WorkloadManagementSystem/Agent/StalledJobAgent.py index e9137468d6d..e65c7f1cbcd 100755 --- a/src/DIRAC/WorkloadManagementSystem/Agent/StalledJobAgent.py +++ b/src/DIRAC/WorkloadManagementSystem/Agent/StalledJobAgent.py @@ -11,22 +11,22 @@ import concurrent.futures import datetime -from DIRAC import S_OK, S_ERROR, gConfig +from DIRAC import S_ERROR, S_OK, gConfig from DIRAC.AccountingSystem.Client.Types.Job import Job -from DIRAC.Core.Base.AgentModule import AgentModule -from DIRAC.Core.Utilities import DErrno -from DIRAC.Core.Utilities.TimeUtilities import fromString, toEpoch, second -from DIRAC.Core.Utilities.ClassAd.ClassAdLight import ClassAd from DIRAC.ConfigurationSystem.Client.Helpers import cfgPath from DIRAC.ConfigurationSystem.Client.Helpers.Registry import getDNForUsername from DIRAC.ConfigurationSystem.Client.PathFinder import getSystemInstance +from DIRAC.Core.Base.AgentModule import AgentModule +from DIRAC.Core.Utilities import DErrno +from DIRAC.Core.Utilities.ClassAd.ClassAdLight import ClassAd +from DIRAC.Core.Utilities.TimeUtilities import fromString, second, toEpoch +from DIRAC.WorkloadManagementSystem.Client import JobMinorStatus, JobStatus from DIRAC.WorkloadManagementSystem.Client.JobManagerClient import JobManagerClient -from DIRAC.WorkloadManagementSystem.Client.WMSClient import WMSClient from DIRAC.WorkloadManagementSystem.Client.JobMonitoringClient import JobMonitoringClient from DIRAC.WorkloadManagementSystem.Client.PilotManagerClient import PilotManagerClient +from DIRAC.WorkloadManagementSystem.Client.WMSClient import WMSClient from DIRAC.WorkloadManagementSystem.DB.JobDB import JobDB from DIRAC.WorkloadManagementSystem.DB.JobLoggingDB import JobLoggingDB -from DIRAC.WorkloadManagementSystem.Client import JobStatus, JobMinorStatus class StalledJobAgent(AgentModule): diff --git a/src/DIRAC/WorkloadManagementSystem/Client/Matcher.py b/src/DIRAC/WorkloadManagementSystem/Client/Matcher.py index 16297431165..ba30f40e63b 100644 --- a/src/DIRAC/WorkloadManagementSystem/Client/Matcher.py +++ b/src/DIRAC/WorkloadManagementSystem/Client/Matcher.py @@ -248,7 +248,7 @@ def _reportStatus(self, resourceDict, jobID): """ attNames = ["Status", "MinorStatus", "ApplicationStatus", "Site"] attValues = ["Matched", "Assigned", "Unknown", resourceDict["Site"]] - result = self.jobDB.setJobAttributes(jobID, attNames, attValues) + result = self.jobDB.setJobAttributes(jobID, attNames, attValues, update=True) if not result["OK"]: self.log.error("Problem reporting job status", f"setJobAttributes, jobID = {jobID}: {result['Message']}") else: