-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix of LumiList.py so to allow the merge of JSON files #44201
Conversation
cms-bot internal usage |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-44201/39183
|
A new Pull Request was created by @syuvivida for master. It involves the following packages:
@smuzaffar, @Dr15Jones, @makortel, @cmsbuild can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change back the cases where the generator is sufficient (because it is more efficient to loop over than creating an intermediate list)?
@@ -73,12 +73,12 @@ def __init__(self, filename = None, lumis = None, runsAndLumis = None, runs = No | |||
if isinstance(runsAndLumis, list): | |||
queued = {} | |||
for runLumiList in runsAndLumis: | |||
for run, lumis in runLumiList.items(): | |||
for run, lumis in list(runLumiList.items()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the earlier use of the items()
generator would work, and would be more efficient
for run, lumis in list(runLumiList.items()): | |
for run, lumis in runLumiList.items(): |
queued.setdefault(run, []).extend(lumis) | ||
runsAndLumis = queued | ||
|
||
if runsAndLumis: | ||
for run in runsAndLumis.keys(): | ||
for run in list(runsAndLumis.keys()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be better with the generator as well
for run in list(runsAndLumis.keys()): | |
for run in runsAndLumis.keys(): |
@@ -100,14 +100,14 @@ def __init__(self, filename = None, lumis = None, runsAndLumis = None, runs = No | |||
self.compactList[runString] = [[1, 0xFFFFFFF]] | |||
|
|||
if compactList: | |||
for run in compactList.keys(): | |||
for run in list(compactList.keys()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too
for run in list(compactList.keys()): | |
for run in compactList.keys(): |
runString = str(run) | ||
if compactList[run]: | ||
self.compactList[runString] = compactList[run] | ||
|
||
# Compact each run and make it unique | ||
|
||
for run in self.compactList.keys(): | ||
for run in list(self.compactList.keys()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
for run in list(self.compactList.keys()): | |
for run in self.compactList.keys(): |
@@ -336,7 +336,7 @@ def selectRuns (self, runList): | |||
Selects only runs from runList in collection | |||
''' | |||
runsToDelete = [] | |||
for run in self.compactList.keys(): | |||
for run in list(self.compactList.keys()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
for run in list(self.compactList.keys()): | |
for run in self.compactList.keys(): |
Hi @makortel |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-44201/39268
|
Pull request #44201 was updated. @smuzaffar, @cmsbuild, @makortel, @Dr15Jones can you please check and sign again. |
Thanks! Could you squash the three commits into one in order to have simpler history? |
Sorry does this mean I shall close this PR and create a new one? |
Opening a new PR is not necessary. You can use
to collapse the commits to one, and then force-push ( I'd suggest to make a "backup" of your branch before doing anything else, e.g. |
Thanks for the tips! Now the 3 commits are merged into one. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-44201/39288
|
Pull request #44201 was updated. @makortel, @Dr15Jones, @cmsbuild, @smuzaffar can you please check and sign again. |
@cmsbuild, please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-9f33c7/37823/summary.html Comparison SummarySummary:
|
+core |
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @rappoccio, @sextonkennedy, @antoniovilela (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
PR description:
While merging the JSON files with mergeJSON.py, we ran into this error:
File "/cvmfs/cms.cern.ch/el9_amd64_gcc12/cms/cmssw/CMSSW_14_0_0/bin/el9_amd64_gcc12/mergeJSON.py", line 44, in <module> finalList = finalList | localList File "/cvmfs/cms.cern.ch/el9_amd64_gcc12/cms/cmssw/CMSSW_14_0_0/src/FWCore/PythonUtilities/python/LumiList.py", line 186, in __or__ runs = set(aruns + bruns) TypeError: unsupported operand type(s) for +: 'dict_keys' and 'dict_keys'
as in Python 3.x, dict.keys doesn't return a list, but instead a view object, dict_keys. Therefore, this PR converted all the runs to a list to solve this error.
PR validation:
The PR has been validated by copying mergeJSON.py to a local area at lxplus and point to the local LumiList.py, with this PR, two JSONs could be merged without errors. Additionally, we also use this version of LumiList.py to launch cron jobs of DCS-only JSON files at lxplus in the central DQM-DC team. The cron jobs patch the new runs with good siStrip/pixel DCS status every day on top of the previous runs (using mergeJSON.py). These cron jobs have been launched 7 days ago and produced results without error.