Repository: dmwm/wmcore
Issue: Global WorkQueue locationUpdateTask thread crashing with AttributeError

**Impact of the bug**
Global WorkQueue

**Describe the bug**
I mixed up the data structs from different places and the code tries to execute `items()` for a set/tuple data type, see traceback from the locationUpdateTask CP thread:
```
2019-10-11 00:57:46,224:INFO:LogDB:<LogDB(url=https://cmsweb.cern.ch/couchdb/wmstats_logdb, identifier=global_workqueue, agent=1)>
2019-10-11 00:57:46,225:INFO:WorkQueue:Executing data location update...
2019-10-11 00:57:48,460:INFO:DataLocationMapper:Fetching location data from PhEDEx with args: {'complete': 'y'}
2019-10-11 00:57:48,521:INFO:DataLocationMapper:Fetching location data from PhEDEx with args: {'complete': 'y'}
2019-10-11 00:58:14,534:INFO:DataLocationMapper:Found 304 unique input data to update location
2019-10-11 00:58:14,545:ERROR:CherryPyPeriodicTask:Periodic Thread ERROR __builtins__.AttributeError 'tuple' object has no attribute 'items'
2019-10-11 00:58:14,598:ERROR:CherryPyPeriodicTask: Traceback (most recent call last):
2019-10-11 00:58:14,598:ERROR:CherryPyPeriodicTask:   File "/data/srv/beHG1910d/sw/slc7_amd64_gcc630/cms/workqueue/1.2.7.pre3/lib/python2.7/site-packages/WMCore/REST/CherryPyPeriodicTask.py", line 91, in run
2019-10-11 00:58:14,598:ERROR:CherryPyPeriodicTask:     self.taskFunc(self.config)
2019-10-11 00:58:14,598:ERROR:CherryPyPeriodicTask:   File "/data/srv/beHG1910d/sw/slc7_amd64_gcc630/cms/workqueue/1.2.7.pre3/lib/python2.7/site-packages/WMCore/GlobalWorkQueue/CherryPyThreads/LocationUpdateTask.py", line 24, in updateDataLocation
2019-10-11 00:58:14,598:ERROR:CherryPyPeriodicTask:     res = globalQ.updateLocationInfo()
2019-10-11 00:58:14,598:ERROR:CherryPyPeriodicTask:   File "/data/srv/beHG1910d/sw/slc7_amd64_gcc630/cms/workqueue/1.2.7.pre3/lib/python2.7/site-packages/WMCore/WorkQueue/WorkQueue.py", line 732, in updateLocationInfo
2019-10-11 00:58:14,598:ERROR:CherryPyPeriodicTask:     result = self.dataLocationMapper()
2019-10-11 00:58:14,598:ERROR:CherryPyPeriodicTask:   File "/data/srv/beHG1910d/sw/slc7_amd64_gcc630/cms/workqueue/1.2.7.pre3/lib/python2.7/site-packages/WMCore/WorkQueue/DataLocationMapper.py", line 177, in __call__
2019-10-11 00:58:14,599:ERROR:CherryPyPeriodicTask:     for data, locations in dataMapping.items():
2019-10-11 00:58:14,599:ERROR:CherryPyPeriodicTask: AttributeError: 'tuple' object has no attribute 'items'
```

**How to reproduce it**
You need to have GQE - with some input data - sitting in Available state.

**Expected behavior**
Not crash! Go through the thread code and update data location for GQEs sitting in Available status.

**Additional context and error message**
We will need a CMSWEB hot fix, on top of 1.2.7.pre3.
Master has a different version of data location update and shouldn't have any issues, but I'll x-check that one too.


Changed files:
src/python/WMCore/WorkQueue/DataLocationMapper.py

diff --git a/src/python/WMCore/WorkQueue/DataLocationMapper.py b/src/python/WMCore/WorkQueue/DataLocationMapper.py
index 063d5e384..8c1860f8e 100644
--- a/src/python/WMCore/WorkQueue/DataLocationMapper.py
+++ b/src/python/WMCore/WorkQueue/DataLocationMapper.py
@@ -65,7 +65,7 @@ class DataLocationMapper(object):
         # the same object is not shared amongst multiple threads
         self.dbses = {}
 
-    def __call__(self, dataItems, dbses=None):
+    def __call__(self, dataItems):
         result = {}
 
         dataByDbs = self.organiseByDbs(dataItems)
@@ -101,7 +101,7 @@ class DataLocationMapper(object):
         elif self.params['locationFrom'] == 'subscription':
             self.logger.info("Fetching subscription data from PhEDEx")
             # subscription api doesn't support partial update
-            result = self.phedex.getSubscriptionMapping(*dataItems), True
+            result = self.phedex.getSubscriptionMapping(*dataItems)
         elif self.params['locationFrom'] == 'location':
             args = {}
             if not self.params['incompleteBlocks']:
@@ -154,7 +154,7 @@ class DataLocationMapper(object):
             psns.update(self.cric.PNNstoPSNs(nodes))
             result[name] = list(psns)
 
-        return result, True  # partial dbs updates not supported
+        return result
 
     def organiseByDbs(self, dataItems):
         """Sort items by dbs instances - return dict with DBSReader as key & data items as values"""