Repository: dmwm/wmcore
Issue: MSUnmerged: Not refreshing Rse Object contents while running with a list of multiple RSEs in a single poling cycle 

**Impact of the bug**
MSUnmerged

**Describe the bug**
While deploying the MSUnmerged micro service, we spotted that the RseObjects contents are not getting refreshed while iterating through the list of RSEs. We saw that the `rse['name']` and some others like `rse['pfnPrefix']` have been updated but not the counters and the list of files to be deleted. [1] [2]

**How to reproduce it**
Just run the service with an RSE expression that produces a list of more than a single RSE.

**Expected behavior**
We expect the contents of the RSE objects to be refreshed and unique to every new RSE traversing the pipeline.

**Additional context and error message**
[1]
```
----------------------------------------------------------
MSUnmergedRSE: 
    counters: 
        deletedFail: 0
        deletedSuccess: 0
        dirsToDelete: 1373
        dirsToDeleteAll: 1373
        filesToDelete: 91785
        totalNumFiles: 245556
    dirs: 
        allUnmerged: 
        empty: 
        protected: 
            /store/unmerged/RunIISummer20UL18SIM/WplusH_HToZZTo4L_M160_TuneCP5_13TeV_powheg2-minlo-HWJ_JHUGenV7011_pythia8/GEN-SIM/106X_upgrade2018_realistic_v11_L1v1-v1
            /store/unmerged/RunIISummer20UL17MiniAODv2/NMSSM_XtoHYto4b_MX_1800_MY_90_TuneCP5_13TeV-madgraph-pythia8/MINIAODSIM/106X_mc2017_realistic_v9-v1
            /store/unmerged/RunIISummer20UL17SIM/HeavyNeutrino_trilepton_M-400_V-0p01_tau_NLO_triLightLepFilter_TuneCP5_13TeV-madgraph-pythia8/GEN-SIM/106X_mc2017_realistic_v6-v1
            /store/unmerged/RunIISummer20UL18RECO/DY4JetsToLL_M-10to50_MatchEWPDG20_TuneCP5_13TeV-madgraphMLM-pythia8/AODSIM/106X_upgrade2018_realistic_v11_L1v1-v1
            /store/unmerged/RunIISummer20UL18NanoAODv2/HeavyNeutrino_trilepton_VBF_M-800_V-0p01_e_NLO_TuneCP5_13TeV-madgraph-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v15_L1v1-v1
            /store/unmerged/RunIISummer20UL18HLT/QCD_Pt_20to30_bcToE_TuneCP5_13TeV_pythia8/GEN-SIM-RAW/102X_upgrade2018_realistic_v15-v2
            ...
        toDelete: 
            /store/unmerged/Run2018D/EGamma/USER/EXOMONOPOLE-12Nov2019_UL2018-v6
            /store/unmerged/RunIISummer20UL16DIGIPremixAPV/GluGluToAToZhToLLTauTau_M325_TuneCP5_13TeV-madgraphMLM-pythia8/GEN-SIM-DIGI/106X_mcRun2_asymptotic_preVFP_v8-v1
            /store/unmerged/RunIISummer20UL17wmLHEGEN/WplusH_HToZZTo2L2Nu_M210_TuneCP5_13TeV_powheg2-minlo-HWJ_JHUGenV735_pythia8/GEN/106X_mc2017_realistic_v6-v1
            /store/unmerged/RunIISummer20UL18wmLHEGEN/TTToSemiLepton_hdampDOWN_HT500Njet9_TuneCP5_13TeV-powheg-pythia8/LHE/106X_upgrade2018_realistic_v4-v1
            /store/unmerged/RunIISummer20UL16wmLHEGEN/QCD_HT1500to2000_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/GEN/106X_mcRun2_asymptotic_v13-v1
            /store/unmerged/RunIISummer20UL16HLT/WJetsToLNu_HT-100To200_TuneCP5_13TeV-madgraphMLM-pythia8/GEN-SIM-RAW/80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1
            ...
    files: 
        allUnmerged: 
            /store/unmerged/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/FEVTDEBUGHLT/NoPUPhase2D80_113X_mcRun4_realistic_T25_v1-v1/270000/04b2625d-d39d-447e-aa3e-df183a161131.root
            /store/unmerged/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/FEVTDEBUGHLT/NoPUPhase2D80_113X_mcRun4_realistic_T25_v1-v1/270000/0cd6e175-12d8-4bb9-9181-369fce59cc3c.root
            /store/unmerged/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/FEVTDEBUGHLT/NoPUPhase2D80_113X_mcRun4_realistic_T25_v1-v1/270000/0e2fe55f-90ee-44f2-80ca-64461ed4c2bf.root
            /store/unmerged/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/FEVTDEBUGHLT/NoPUPhase2D80_113X_mcRun4_realistic_T25_v1-v1/270000/1f0b1042-3469-44f7-8ef0-435a98412f4b.root
            /store/unmerged/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/FEVTDEBUGHLT/NoPUPhase2D80_113X_mcRun4_realistic_T25_v1-v1/270000/2211d152-891d-488a-b352-36b3fe8b2c3b.root
            /store/unmerged/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/FEVTDEBUGHLT/NoPUPhase2D80_113X_mcRun4_realistic_T25_v1-v1/270000/2ed2f4b6-c15f-4e96-83a5-5bec17be473a.root
            ...
        deletedFail: 
        deletedSuccess: 
        protected: 
        toDelete: 
            /store/unmerged/Phase2HLTTDRSummer20ReRECOMiniAOD/DYToLL_M-50_TuneCP5_14TeV-pythia8/FEVT/FlatPU0To200_pilot_111X_mcRun4_realistic_T15_v1-v2: <generator object MSUnmerged.filterUnmergedFiles.<locals>.genFunc at 0x7f1c6efca830>
            /store/unmerged/Run2016B/MuOnia/MINIAOD/ver2_HIPM_UL2016_MiniAODv2-v1: <generator object MSUnmerged.filterUnmergedFiles.<locals>.genFunc at 0x7f1c6f028f10>
            /store/unmerged/Run2016D/DoubleMuon/MINIAOD/HIPM_UL2016_MiniAODv2-v1: <generator object MSUnmerged.filterUnmergedFiles.<locals>.genFunc at 0x7f1c6efd1fc0>
            /store/unmerged/Run2016D/MET/MINIAOD/HIPM_UL2016_MiniAODv2-v2: <generator object MSUnmerged.filterUnmergedFiles.<locals>.genFunc at 0x7f1c6f021468>
            /store/unmerged/Run2016E/Charmonium/MINIAOD/HIPM_UL2016_MiniAODv2-v1: <generator object MSUnmerged.filterUnmergedFiles.<locals>.genFunc at 0x7f1c6f028db0>
            /store/unmerged/Run2016H/JetHT/MINIAOD/UL2016_MiniAODv2-v1: <generator object MSUnmerged.filterUnmergedFiles.<locals>.genFunc at 0x7f1c6efd16d0>
            ...
    isClean: False
    name: T2_US_Caltech_Ceph
    pfnPrefix: gsiftp://transfer-lb.ultralight.org:2811/storage/cms

----------------------------------------------------------

```

[2]
```
MSUnmergedRSE: 
    counters: 
        deletedFail: 0
        deletedSuccess: 0
        dirsToDelete: 1373
        dirsToDeleteAll: 1373
        filesToDelete: 91785
        totalNumFiles: 245556
    dirs: 
        allUnmerged: 
        empty: 
        protected: 
            /store/unmerged/RunIISummer20UL18SIM/WplusH_HToZZTo4L_M160_TuneCP5_13TeV_powheg2-minlo-HWJ_JHUGenV7011_pythia8/GEN-SIM/106X_upgrade2018_realistic_v11_L1v1-v1
            /store/unmerged/RunIISummer20UL17MiniAODv2/NMSSM_XtoHYto4b_MX_1800_MY_90_TuneCP5_13TeV-madgraph-pythia8/MINIAODSIM/106X_mc2017_realistic_v9-v1
            /store/unmerged/RunIISummer20UL17SIM/HeavyNeutrino_trilepton_M-400_V-0p01_tau_NLO_triLightLepFilter_TuneCP5_13TeV-madgraph-pythia8/GEN-SIM/106X_mc2017_realistic_v6-v1
            /store/unmerged/RunIISummer20UL18RECO/DY4JetsToLL_M-10to50_MatchEWPDG20_TuneCP5_13TeV-madgraphMLM-pythia8/AODSIM/106X_upgrade2018_realistic_v11_L1v1-v1
            /store/unmerged/RunIISummer20UL18NanoAODv2/HeavyNeutrino_trilepton_VBF_M-800_V-0p01_e_NLO_TuneCP5_13TeV-madgraph-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v15_L1v1-v1
            /store/unmerged/RunIISummer20UL18HLT/QCD_Pt_20to30_bcToE_TuneCP5_13TeV_pythia8/GEN-SIM-RAW/102X_upgrade2018_realistic_v15-v2
            ...
        toDelete: 
            /store/unmerged/Run2018D/EGamma/USER/EXOMONOPOLE-12Nov2019_UL2018-v6
            /store/unmerged/RunIISummer20UL16DIGIPremixAPV/GluGluToAToZhToLLTauTau_M325_TuneCP5_13TeV-madgraphMLM-pythia8/GEN-SIM-DIGI/106X_mcRun2_asymptotic_preVFP_v8-v1
            /store/unmerged/RunIISummer20UL17wmLHEGEN/WplusH_HToZZTo2L2Nu_M210_TuneCP5_13TeV_powheg2-minlo-HWJ_JHUGenV735_pythia8/GEN/106X_mc2017_realistic_v6-v1
            /store/unmerged/RunIISummer20UL18wmLHEGEN/TTToSemiLepton_hdampDOWN_HT500Njet9_TuneCP5_13TeV-powheg-pythia8/LHE/106X_upgrade2018_realistic_v4-v1
            /store/unmerged/RunIISummer20UL16wmLHEGEN/QCD_HT1500to2000_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/GEN/106X_mcRun2_asymptotic_v13-v1
            /store/unmerged/RunIISummer20UL16HLT/WJetsToLNu_HT-100To200_TuneCP5_13TeV-madgraphMLM-pythia8/GEN-SIM-RAW/80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1
            ...
    files: 
        allUnmerged: 
            /store/unmerged/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/FEVTDEBUGHLT/NoPUPhase2D80_113X_mcRun4_realistic_T25_v1-v1/270000/04b2625d-d39d-447e-aa3e-df183a161131.root
            /store/unmerged/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/FEVTDEBUGHLT/NoPUPhase2D80_113X_mcRun4_realistic_T25_v1-v1/270000/0cd6e175-12d8-4bb9-9181-369fce59cc3c.root
            /store/unmerged/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/FEVTDEBUGHLT/NoPUPhase2D80_113X_mcRun4_realistic_T25_v1-v1/270000/0e2fe55f-90ee-44f2-80ca-64461ed4c2bf.root
            /store/unmerged/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/FEVTDEBUGHLT/NoPUPhase2D80_113X_mcRun4_realistic_T25_v1-v1/270000/1f0b1042-3469-44f7-8ef0-435a98412f4b.root
            /store/unmerged/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/FEVTDEBUGHLT/NoPUPhase2D80_113X_mcRun4_realistic_T25_v1-v1/270000/2211d152-891d-488a-b352-36b3fe8b2c3b.root
            /store/unmerged/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/FEVTDEBUGHLT/NoPUPhase2D80_113X_mcRun4_realistic_T25_v1-v1/270000/2ed2f4b6-c15f-4e96-83a5-5bec17be473a.root
            ...
        deletedFail: 
        deletedSuccess: 
        protected: 
        toDelete: 
            /store/unmerged/Phase2HLTTDRSummer20ReRECOMiniAOD/DYToLL_M-50_TuneCP5_14TeV-pythia8/FEVT/FlatPU0To200_pilot_111X_mcRun4_realistic_T15_v1-v2: <generator object MSUnmerged.filterUnmergedFiles.<locals>.genFunc at 0x7f1c6ef87830>
            /store/unmerged/Run2016B/MuOnia/MINIAOD/ver2_HIPM_UL2016_MiniAODv2-v1: <generator object MSUnmerged.filterUnmergedFiles.<locals>.genFunc at 0x7f1c6ef65f10>
            /store/unmerged/Run2016D/DoubleMuon/MINIAOD/HIPM_UL2016_MiniAODv2-v1: <generator object MSUnmerged.filterUnmergedFiles.<locals>.genFunc at 0x7f1c6ef0efc0>
            /store/unmerged/Run2016D/MET/MINIAOD/HIPM_UL2016_MiniAODv2-v2: <generator object MSUnmerged.filterUnmergedFiles.<locals>.genFunc at 0x7f1c6ef5f468>
            /store/unmerged/Run2016E/Charmonium/MINIAOD/HIPM_UL2016_MiniAODv2-v1: <generator object MSUnmerged.filterUnmergedFiles.<locals>.genFunc at 0x7f1c6ef65db0>
            /store/unmerged/Run2016H/JetHT/MINIAOD/UL2016_MiniAODv2-v1: <generator object MSUnmerged.filterUnmergedFiles.<locals>.genFunc at 0x7f1c6ef0e6d0>
            ...
    isClean: False
    name: T2_US_Wisconsin
    pfnPrefix: gsiftp://cms-lvs-gridftp.hep.wisc.edu:2811/hdfs

----------------------------------------------------------


```

Changed files:
src/python/WMCore/Services/RucioConMon/RucioConMon.py, src/python/WMCore/MicroService/MSUnmerged/MSUnmerged.py

diff --git a/src/python/WMCore/MicroService/MSUnmerged/MSUnmerged.py b/src/python/WMCore/MicroService/MSUnmerged/MSUnmerged.py
index 3919bed1b..235984c9a 100644
--- a/src/python/WMCore/MicroService/MSUnmerged/MSUnmerged.py
+++ b/src/python/WMCore/MicroService/MSUnmerged/MSUnmerged.py
@@ -152,10 +152,10 @@ class MSUnmerged(MSCore):
 
         try:
             rseList = self.getRSEList()
+            msg = "Retrieved list of %s RSEs: %s "
+            msg += "Service set to process up to %s RSEs per instance."
+            self.logger.info(msg, len(rseList), pformat(rseList), self.msConfig["limitRSEsPerInstance"])
             random.shuffle(rseList)
-            msg = "  retrieved %s RSEs. " % len(rseList)
-            msg += "Service set to process up to %s RSEs per instance." % self.msConfig["limitRSEsPerInstance"]
-            self.logger.info(msg)
         except Exception as err:  # general error
             msg = "Unknown exception while trying to estimate the final RSEs to work on. Error: %s", str(err)
             self.logger.exception(msg)
diff --git a/src/python/WMCore/Services/RucioConMon/RucioConMon.py b/src/python/WMCore/Services/RucioConMon/RucioConMon.py
index 220b6587b..0fb828b55 100644
--- a/src/python/WMCore/Services/RucioConMon/RucioConMon.py
+++ b/src/python/WMCore/Services/RucioConMon/RucioConMon.py
@@ -100,7 +100,7 @@ class RucioConMon(Service):
         #       in the future.
         if not zipped:
             uri = "WM/files?rse=%s&format=json" % rseName
-            rseUnmerged = self._getResult(uri, callname='unmerged')
+            rseUnmerged = self._getResult(uri, callname=rseName)
             return rseUnmerged
         else:
             pass