Repository: dmwm/wmcore
Issue: ArchiverDataPoller failing to parse documents

**Impact of the bug**
WMAgent

**Describe the bug**
It's still unclear to me whether it's a bug or something new coming from a CMSSW release(?) Looking into the ArchiveDataReporter component in the FNAL submit6 agent, I see this error/traceback over and over [1]

**How to reproduce it**
No clue

**Expected behavior**
Investigate if there is anything wrong with those FJR and either add a protection in WMAgent, or actually fix whatever problem that needs to be fixed with ArchiveDataReporter and how those FJR documents are converted to WMArchive ones.

**Additional context and error message**
[1]
```
2022-05-27 14:28:43,750:139988735846144:INFO:ArchiveDataPoller:Found 1000 not archived documents from FWRJ db to upload to WMArchive.
2022-05-27 14:28:44,315:139988735846144:ERROR:ArchiveDataPoller:Error occurred, will retry later:
2022-05-27 14:28:44,315:139988735846144:ERROR:ArchiveDataPoller:more than one input value ['source', 'ce']
2022-05-27 14:28:44,315:139988735846144:ERROR:ArchiveDataPoller:Trace back: 
Traceback (most recent call last):
  File "/data/srv/wmagent/v2.0.2.patch1/sw/slc7_amd64_gcc630/cms/wmagentpy3/2.0.2.patch1/lib/python3.8/site-packages/WMComponent/ArchiveDataReporter/ArchiveDataPoller.py", line 53, in algorithm
    doc = createArchiverDoc(job)
  File "/data/srv/wmagent/v2.0.2.patch1/sw/slc7_amd64_gcc630/cms/wmagentpy3/2.0.2.patch1/lib/python3.8/site-packages/WMCore/Services/WMArchive/DataMap.py", line 394, in createArchiverDoc
    newfwjr = convertToArchiverFormat(fwjr)
  File "/data/srv/wmagent/v2.0.2.patch1/sw/slc7_amd64_gcc630/cms/wmagentpy3/2.0.2.patch1/lib/python3.8/site-packages/WMCore/Services/WMArchive/DataMap.py", line 320, in convertToArchiverFormat
    newFWJR["steps"] = convertSteps(newFWJR["steps"])
  File "/data/srv/wmagent/v2.0.2.patch1/sw/slc7_amd64_gcc630/cms/wmagentpy3/2.0.2.patch1/lib/python3.8/site-packages/WMCore/Services/WMArchive/DataMap.py", line 309, in convertSteps
    stepItem.update(convertStepValue(value))
  File "/data/srv/wmagent/v2.0.2.patch1/sw/slc7_amd64_gcc630/cms/wmagentpy3/2.0.2.patch1/lib/python3.8/site-packages/WMCore/Services/WMArchive/DataMap.py", line 276, in convertStepValue
    raise Exception("more than one input value %s" % list(stepValue['input']))
Exception: more than one input value ['source', 'ce']
```

Changed files:
src/python/WMCore/Services/WMArchive/DataMap.py

diff --git a/src/python/WMCore/Services/WMArchive/DataMap.py b/src/python/WMCore/Services/WMArchive/DataMap.py
index 06ddfbfa1..e8ecb5132 100644
--- a/src/python/WMCore/Services/WMArchive/DataMap.py
+++ b/src/python/WMCore/Services/WMArchive/DataMap.py
@@ -6,6 +6,7 @@ from future.utils import viewitems, listvalues, listitems
 import copy
 import socket
 from collections import defaultdict
+import logging
 
 # From top level
 
@@ -270,16 +271,21 @@ def convertStepValue(stepValue):
         if not stepValue['input']:
             # if empty convert to list from {}
             stepValue['input'] = []
-
-        elif len(stepValue['input']) > 1:
-            # assume only one input value
-            raise Exception("more than one input value %s" % list(stepValue['input']))
-
-        elif list(stepValue['input'].keys())[0] in input_keys:
-            stepValue['input'] = convertInput(stepValue['input'][list(stepValue['input'])[0]])
-
         else:
-            raise Exception("Unknow iput key %s" % list(stepValue['input']))
+            if len(stepValue['input']) > 1:
+                # skip input values that are not in input_keys
+                # to work around issue #11168
+                for key in list(stepValue['input']):
+                    if key not in input_keys:
+                        del stepValue['input'][key]
+                if len(stepValue['input']) > 1:
+                    raise Exception("more than one input value %s" % list(stepValue['input']))
+                else:
+                    logging.info("Input values with empty tags found. They will be ignored.")
+            if list(stepValue['input'].keys())[0] in input_keys:
+                stepValue['input'] = convertInput(stepValue['input'][list(stepValue['input'])[0]])
+            else:
+                raise Exception("Unknow iput key %s" % list(stepValue['input']))
 
     if "output" in stepValue:
         # remove output module name layer