diff --git a/src/python/WMCore/Services/ReqMgrAux/ReqMgrAux.py b/src/python/WMCore/Services/ReqMgrAux/ReqMgrAux.py index 58e43562db..97e1e421f3 100644 --- a/src/python/WMCore/Services/ReqMgrAux/ReqMgrAux.py +++ b/src/python/WMCore/Services/ReqMgrAux/ReqMgrAux.py @@ -410,8 +410,10 @@ def listDiskUsageOverThreshold(config, updateDB): if updateDB and not t0Flag: agentDrainMode = bool(len(overThresholdDisks)) - if agentConfig and (agentDrainMode != agentConfig["AgentDrainMode"]): - reqMgrAux.updateWMAgentConfig(config.Agent.hostName, {"AgentDrainMode": agentDrainMode}, - inPlace=True) + if agentConfig and (agentDrainMode != agentConfig.get("AgentDrainMode")): + if agentConfig.get("UserDrainMode") is True: + logging.info("Agent is already in UserDrainMode: True mode. No need to update.") + else: + reqMgrAux.updateWMAgentConfig(config.Agent.hostName, {"AgentDrainMode": agentDrainMode}, inPlace=True) return overThresholdDisks