Repository: dmwm/wmcore
Issue: Don't create subscriptions for IgnoredOutputModules

This IgnoredOutputModules is a feature available only for TaskChain an Resubmission and it's mainly used by the recovery script (to recover ReReco lumis).

Needs more investigation, but it seems WorkQueueManager creates a subscription even for those output modules that we want to ignore, which later on brings problems in JobAccountant that will x-check the outputModules expected (database call) against the job outputs (which fails in this case). 


Changed files:
src/python/WMCore/WMSpec/WMTask.py, test/python/WMCore_t/WMSpec_t/StdSpecs_t/TaskChain_t.py, src/python/WMCore/WorkQueue/WMBSHelper.py

diff --git a/src/python/WMCore/WMSpec/WMTask.py b/src/python/WMCore/WMSpec/WMTask.py
index bb2282edc..8d33849c2 100644
--- a/src/python/WMCore/WMSpec/WMTask.py
+++ b/src/python/WMCore/WMSpec/WMTask.py
@@ -270,9 +270,20 @@ class WMTaskHelper(TreeHelper):
         outputModules = []
         for stepName in self.listAllStepNames():
             outputModules.append(self.getOutputModulesForStep(stepName))
-
         return outputModules
 
+    def getIgnoredOutputModulesForTask(self):
+        """
+        _getIgnoredOutputModulesForTask_
+
+        Retrieve the ignored output modules in the given task.
+        """
+        ignoredOutputModules = []
+        for stepName in self.listAllStepNames():
+            stepHelper = self.getStepHelper(stepName)
+            ignoredOutputModules.extend(stepHelper.getIgnoredOutputModules())
+        return ignoredOutputModules
+
     def getOutputModulesForStep(self, stepName):
         """
         _getOutputModulesForStep_
diff --git a/src/python/WMCore/WorkQueue/WMBSHelper.py b/src/python/WMCore/WorkQueue/WMBSHelper.py
index dfd797864..e18f78f43 100644
--- a/src/python/WMCore/WorkQueue/WMBSHelper.py
+++ b/src/python/WMCore/WorkQueue/WMBSHelper.py
@@ -309,8 +309,12 @@ class WMBSHelper(WMConnectionBase):
             logging.info("Child subscription created: %s" % subscription["id"])
 
         outputModules = task.getOutputModulesForTask()
+        ignoredOutputModules = task.getIgnoredOutputModulesForTask()
         for outputModule in outputModules:
             for outputModuleName in outputModule.listSections_():
+                if outputModuleName in ignoredOutputModules:
+                    logging.info("IgnoredOutputModule set for %s, skipping fileset creation.", outputModuleName)
+                    continue
                 outputFileset = Fileset(self.outputFilesetName(task, outputModuleName))
                 outputFileset.create()
                 outputFileset.markOpen(True)
diff --git a/test/python/WMCore_t/WMSpec_t/StdSpecs_t/TaskChain_t.py b/test/python/WMCore_t/WMSpec_t/StdSpecs_t/TaskChain_t.py
index 7f385f4fb..ad93aa96f 100644
--- a/test/python/WMCore_t/WMSpec_t/StdSpecs_t/TaskChain_t.py
+++ b/test/python/WMCore_t/WMSpec_t/StdSpecs_t/TaskChain_t.py
@@ -346,6 +346,8 @@ class TaskChainTests(unittest.TestCase):
         workflow.load()
 
         outputMods = outputModuleList(task)
+        ignoredOutputMods = task.getIgnoredOutputModulesForTask()
+        outputMods = set(outputMods) - set(ignoredOutputMods)
         self.assertEqual(len(workflow.outputMap.keys()), len(outputMods),
                          "Error: Wrong number of WF outputs")