Skip to content

Commit

Permalink
Apply Alan's suggestion to reduce loop operation for known pileups
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Feb 6, 2024
1 parent 035790b commit ace826a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/python/WMComponent/WorkflowUpdater/WorkflowUpdaterPoller.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,15 @@ def algorithm(self, parameters=None):
with CodeTimer("Rucio block resolution", logger=logging):
self.findRucioBlocks(uniqueActivePU, msPileupList)

# loop over existing pileup names and
# loop over existing pileup names and compose list of ones we need to adjust
pileupList = []
for rec in puWflows:
for spec in msPileupList:
if spec['pileupName'] == rec['name']:
pileupList.append(spec)
# find the json files in the spec/sandbox area and tweak them
self.adjustJSONSpec(msPileupList)
self.adjustJSONSpec(pileupList)
# self.adjustJSONSpec(msPileupList)
except Exception as ex:
msg = f"Caught unexpected exception in WorkflowUpdater. Details:\n{str(ex)}"
logging.exception(msg)
Expand Down Expand Up @@ -309,6 +315,9 @@ def adjustJSONSpec(self, msPileupList):

# construct jdict={"path-to-json1": jdoc1, "path-to-json2": jdoc2}
jdict = {}
# TODO: verify that we do not overdo this for all pileup conf files
# please see Alans' concern here:
# https://github.com/dmwm/WMCore/pull/11884#discussion_r1479196670
for fname in pileupConfFiles:
jdoc = extractPileupconf(tfile, fname)
bdict = blockLocations(jdoc)
Expand All @@ -320,7 +329,7 @@ def adjustJSONSpec(self, msPileupList):
continue

self.logger.info("Update pileup configureation file %s", fname)
updateBlockInfo(jdoc, rdict, bdict)
jdoc = updateBlockInfo(jdoc, rdict, bdict)
jdict[fname] = jdoc

# replace pileupconf.json files within tarball
Expand Down

0 comments on commit ace826a

Please sign in to comment.