Skip to content
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

Wrong string conversion in DBFormatter.formatDict method #10235

Closed
amaltaro opened this issue Jan 21, 2021 · 1 comment · Fixed by #10238
Closed

Wrong string conversion in DBFormatter.formatDict method #10235

amaltaro opened this issue Jan 21, 2021 · 1 comment · Fixed by #10238

Comments

@amaltaro
Copy link
Contributor

Impact of the bug
WMAgent (apparently only with oracle backend)

Describe the bug
When deploying WMAgent, the step where the resource-control tables get populate fail because the DAO output fails to get properly formatted. Issue seems to come from the DBFormatter changes applied in this PR (which despite being closed, it has actually being merged):
#10057

so it's related to the complicated way of dealing with strings in py2/py3.

How to reproduce it
Source the agent environment and run this command (in an agent running oracle):

$manage execute-agent wmagent-resource-control --add-T1s --plugin=SimpleCondorPlugin --pending-slots=50 --running-slots=50 --down

Expected behavior
Strings/unicode should be properly converted and sites should be successfully inserted into the WMAgent resource-control database.

Additional context and error message
Traceback from running the command above:

cmst1@vocms0192:/data/srv/wmagent/current $ $manage execute-agent wmagent-resource-control --add-T1s --plugin=SimpleCondorPlugin --pending-slots=50 --running-slots=50 --down
WMAgent with Rucio enabled: true
Executing wmagent-resource-control --add-T1s --plugin=SimpleCondorPlugin --pending-slots=50 --running-slots=50 --down ...
Retrieved 7 maps from https://cms-cric.cern.ch/
Traceback (most recent call last):
  File "/data/srv/wmagent/v1.4.5.pre3-comp/sw.amaltaro/slc7_amd64_gcc630/cms/wmagent/1.4.5.pre3-comp/bin/wmagent-resource-control", line 325, in <module>
    options.pendingSlots, options.runningSlots, state=options.state)
  File "/data/srv/wmagent/v1.4.5.pre3-comp/sw.amaltaro/slc7_amd64_gcc630/cms/wmagent/1.4.5.pre3-comp/bin/wmagent-resource-control", line 131, in addSites
    ceName or siteName, allSites[siteName], plugin, cmsName or siteName)
  File "/data/srv/wmagent/v1.4.5.pre3-comp/sw.amaltaro/slc7_amd64_gcc630/cms/wmagent/1.4.5.pre3-comp/bin/wmagent-resource-control", line 209, in updateSiteInfo
    if resourceControl.listSiteInfo(siteName) is None:
  File "/data/srv/wmagent/v1.4.5.pre3-comp/sw.amaltaro/slc7_amd64_gcc630/cms/wmagent/1.4.5.pre3-comp/lib/python2.7/site-packages/WMCore/ResourceControl/ResourceControl.py", line 125, in listSiteInfo
    transaction=self.existingTransaction())
  File "/data/srv/wmagent/v1.4.5.pre3-comp/sw.amaltaro/slc7_amd64_gcc630/cms/wmagent/1.4.5.pre3-comp/lib/python2.7/site-packages/WMCore/WMBS/MySQL/Locations/GetSiteInfo.py", line 32, in execute
    return self.formatDict(results)
  File "/data/srv/wmagent/v1.4.5.pre3-comp/sw.amaltaro/slc7_amd64_gcc630/cms/wmagent/1.4.5.pre3-comp/lib/python2.7/site-packages/WMCore/Database/DBFormatter.py", line 81, in formatDict
    entry[str(descriptions[index].lower())] = bytes(i[index])
  File "/data/srv/wmagent/v1.4.5.pre3-comp/sw.amaltaro/slc7_amd64_gcc630/external/py2-future/0.18.2-comp/lib/python2.7/site-packages/future/types/newbytes.py", line 97, in __new__
    raise TypeError('unicode string argument without an encoding')
TypeError: unicode string argument without an encoding
@mapellidario
Copy link
Member

mapellidario commented Jan 22, 2021

We managed to test it and the problem pretty quickly! nice! (reviewed!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment