From 7b2ed56c17718266664d1ccdbfe4a93c523ec3d2 Mon Sep 17 00:00:00 2001
From: Chris Burr <christopher.burr@cern.ch>
Date: Wed, 10 Jul 2024 21:36:09 +0200
Subject: [PATCH 1/2] Fix dirac-production-request-run-local

---
 .../scripts/dirac_production_request_run_local.py               | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/LHCbDIRAC/ProductionManagementSystem/scripts/dirac_production_request_run_local.py b/src/LHCbDIRAC/ProductionManagementSystem/scripts/dirac_production_request_run_local.py
index 3c14312667..082ec3cb92 100644
--- a/src/LHCbDIRAC/ProductionManagementSystem/scripts/dirac_production_request_run_local.py
+++ b/src/LHCbDIRAC/ProductionManagementSystem/scripts/dirac_production_request_run_local.py
@@ -264,7 +264,7 @@ def main():
 
     # TODO: pr._buildProduction eats stepsInProd
     prod = pr._buildProduction(**kwargs)
-    return returnValueOrRaise(prod.runLocal())
+    returnValueOrRaise(prod.runLocal())
 
 
 def prepareProductionRequest(
-- 
GitLab


From ca030215c50d583c91a5490cf915cee2f144787b Mon Sep 17 00:00:00 2001
From: Chris Burr <christopher.burr@cern.ch>
Date: Wed, 10 Jul 2024 21:40:02 +0200
Subject: [PATCH 2/2] fix (PMS): Assume input is inactive for transformations
 with a bookkeeping query end date

---
 .../Agent/ProductionStatusAgent.py                    | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/LHCbDIRAC/ProductionManagementSystem/Agent/ProductionStatusAgent.py b/src/LHCbDIRAC/ProductionManagementSystem/Agent/ProductionStatusAgent.py
index 539bddc755..fc28f68776 100644
--- a/src/LHCbDIRAC/ProductionManagementSystem/Agent/ProductionStatusAgent.py
+++ b/src/LHCbDIRAC/ProductionManagementSystem/Agent/ProductionStatusAgent.py
@@ -572,13 +572,6 @@ class ProductionStatusAgent(AgentModule):
                         f"{tID} ({prID}) as the input query has an end date",
                     )
                     continue
-                if "hasActiveInput" in tInfo:
-                    self.log.info(
-                        "hasActiveInput has been overridden for",
-                        f"{tID} ({prID}) to be {tInfo['hasActiveInput']}",
-                    )
-                    tInfo["hasActiveInput"] = True
-                    continue
                 for inputID in tInfo["inputIDs"]:
                     if inputID in summary["prods"]:
                         inputState = summary["prods"][inputID]["state"]
@@ -615,7 +608,9 @@ class ProductionStatusAgent(AgentModule):
                 return S_ERROR("Too dangerous to continue")
             inputBkQuery = retVal["Value"]
             tInfo["hasEndDate"] = "EndDate" in inputBkQuery
-            if inputBkQuery.get("ConfigVersion") in Operations().getValue("AnalysisProductions/ForceActiveInput", []):
+            if not tInfo["hasEndDate"] and inputBkQuery.get("ConfigVersion") in Operations().getValue(
+                "AnalysisProductions/ForceActiveInput", []
+            ):
                 tInfo["hasActiveInput"] = True
             if "ProductionID" in inputBkQuery:
                 tInfo["inputIDs"] = [inputBkQuery["ProductionID"]]
-- 
GitLab