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

Improve py2 compatibility of WMException __init__ #9868

Merged
merged 2 commits into from
Aug 21, 2020

Conversation

mapellidario
Copy link
Member

Fixes #9862

Status

ready

Description

Small change to WMException.__init__ in order to improve its handling of unicode error messages in python2

Is it backward compatible (if not, which system it affects?)

yes

External dependencies / deployment changes

This makes WMException depend on python future

@cmsdmwmbot
Copy link

Jenkins results:

  • Unit tests: failed
    • 2 new failures
    • 1 tests no longer failing
    • 2 changes in unstable tests
  • Pylint check: succeeded
    • 2 warnings
    • 4 comments to review
  • Pycodestyle check: succeeded
    • 2 comments to review
  • Python3 compatibility checks: succeeded
    • there are suggested fixes for newer python3 idioms

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/10302/artifact/artifacts/PullRequestReport.html

@cmsdmwmbot
Copy link

Jenkins results:

  • Unit tests: succeeded
    • 2 tests no longer failing
    • 1 changes in unstable tests
  • Pylint check: succeeded
    • 2 warnings
    • 4 comments to review
  • Pycodestyle check: succeeded
    • 2 comments to review
  • Python3 compatibility checks: succeeded
    • there are suggested fixes for newer python3 idioms

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/10303/artifact/artifacts/PullRequestReport.html

@cmsdmwmbot
Copy link

Jenkins results:

  • Unit tests: failed
    • 3 new failures
    • 1 tests added
    • 5 changes in unstable tests
  • Pylint check: failed
    • 6 warnings and errors that must be fixed
    • 2 warnings
    • 9 comments to review
  • Pycodestyle check: succeeded
    • 7 comments to review
  • Python3 compatibility checks: succeeded
    • there are suggested fixes for newer python3 idioms

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/10309/artifact/artifacts/PullRequestReport.html

@amaltaro
Copy link
Contributor

Dario, can you please apply the suggested "python3 idioms"?

@mapellidario
Copy link
Member Author

I did not do it because it can cause trouble such as in #9852, but I agree that in this case it should cause any problems using isinstance instead of checking the typed directly

@amaltaro
Copy link
Contributor

@mapellidario could you please fix the conflicts here and fire another review request once you're done with your changes? Thanks

@cmsdmwmbot
Copy link

Jenkins results:

  • Unit tests: failed
    • 1 new failures
    • 1 tests added
    • 1 changes in unstable tests
  • Pylint check: failed
    • 7 warnings and errors that must be fixed
    • 2 warnings
    • 14 comments to review
  • Pycodestyle check: succeeded
    • 7 comments to review
  • Python3 compatibility checks: succeeded
    • there are suggested fixes for newer python3 idioms

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/10338/artifact/artifacts/PullRequestReport.html

This solves the issue dmwm#9862,
The rationale for this change is described in the
issue comments
New unit test in WMException_t.py to check if WMException handles correctly
a message string that contains unicode characters
@cmsdmwmbot
Copy link

Jenkins results:

  • Unit tests: succeeded
    • 1 tests added
  • Pylint check: failed
    • 6 warnings and errors that must be fixed
    • 2 warnings
    • 13 comments to review
  • Pycodestyle check: succeeded
    • 7 comments to review
  • Python3 compatibility checks: succeeded
    • there are suggested fixes for newer python3 idioms

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/10340/artifact/artifacts/PullRequestReport.html

@mapellidario mapellidario requested a review from amaltaro August 20, 2020 11:44
Copy link
Contributor

@amaltaro amaltaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Dario!

@amaltaro amaltaro merged commit 36ce39b into dmwm:master Aug 21, 2020
@amaltaro
Copy link
Contributor

amaltaro commented Sep 2, 2020

I was looking at the backfill agent (vocms0285), and I've spotted a few jobs failing with errors like (wmagentJob.log):

2020-09-01 23:18:55,930:INFO:PerformanceMonitor:PSS: 133864; RSS: 133860; PCPU: 0.0; PMEM: 0.0
2020-09-01 23:23:44,021:CRITICAL:CMSSW:Error running cmsRun
{'arguments': ['/bin/bash', '/srv/job/WMTaskSpace/cmsRun1/cmsRun1-main.sh', '', u'slc7_amd64_gcc700', 'scramv1', 'CMSSW', 'CMSSW_10_6_9', 'FrameworkJobReport.xml', 'cmsRun', 'PSet.py', '', '', '']}
Linux Return code: 135

2020-09-01 23:23:44,021:CRITICAL:CMSSW:Error message: None
2020-09-01 23:23:44,352:ERROR:ExecuteMaster:Exception occured when executing step
2020-09-01 23:23:44,352:ERROR:ExecuteMaster:Exception is unknown encoding: utf-8
2020-09-01 23:23:44,353:ERROR:ExecuteMaster:Traceback:
2020-09-01 23:23:44,354:ERROR:ExecuteMaster:Traceback (most recent call last):
  File "/srv/job/WMCore.zip/WMCore/WMSpec/Steps/ExecuteMaster.py", line 139, in doExecution
    executionObject.execute()
  File "/srv/job/WMCore.zip/WMCore/WMSpec/Steps/Executors/CMSSW.py", line 284, in execute
    raise WMExecutionFailure(returnCode, "CmsRunFailure", msg)
  File "/srv/job/WMCore.zip/WMCore/WMSpec/Steps/WMExecutionFailure.py", line 18, in __init__
    WMException.__init__(self, detail, code)
  File "/srv/job/WMCore.zip/WMCore/WMException.py", line 33, in __init__
    message = message.decode('utf-8', 'ignore')
LookupError: unknown encoding: utf-8

2020-09-01 23:23:44,354:CRITICAL:CMSSW:CMSDefaultHandler Diagnostic Handler invoked
2020-09-01 23:23:44,356:ERROR:ExecuteMaster:Encountered error while running ExecuteMaster:
unknown encoding: utf-8
Traceback (most recent call last):
  File "/srv/job/WMCore.zip/WMCore/WMSpec/Steps/ExecuteMaster.py", line 73, in __call__
    result = self.doExecution(executor, step, wmbsJob)
  File "/srv/job/WMCore.zip/WMCore/WMSpec/Steps/ExecuteMaster.py", line 149, in doExecution
    executor.diagnostic(99109, executor, ExceptionInstance=ex)
  File "/srv/job/WMCore.zip/WMCore/WMSpec/Steps/Diagnostic.py", line 87, in __call__
    handler(errCode, executor, **args)
  File "/srv/job/WMCore.zip/WMCore/WMSpec/Steps/Diagnostics/CMSSW.py", line 102, in __call__
    self.parse(executor, jobRepXml)
  File "/srv/job/WMCore.zip/WMCore/WMSpec/Steps/Diagnostic.py", line 42, in parse
    executorInstance.report.parse(jobRepXml, executorInstance.stepName)
  File "/srv/job/WMCore.zip/WMCore/FwkJobReport/Report.py", line 156, in parse
    raise FwkJobReportException(msg)
  File "/srv/job/WMCore.zip/WMCore/WMException.py", line 33, in __init__
    message = message.decode('utf-8', 'ignore')
LookupError: unknown encoding: utf-8


2020-09-01 23:23:44,357:INFO:Watchdog:MonitorThread: JobEnded

@mapellidario can I ask you to look into this PR and try to backport it to the branch 1.3.6_wmagent? That branch does not have any of these code modernization, so it might not be very straight forward...
Once you have it ready, please make a PR against the 1.3.6_wmagent branch and we can start testing your changes in the backfill agent itself (I'll take care of the testing). Thanks

@amaltaro
Copy link
Contributor

amaltaro commented Sep 2, 2020

Oh, if you consider it to be a new issue, then go ahead and file a new GH issue and start working on a bug fix please.

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

Successfully merging this pull request may close these issues.

Report message encoding error in JobCreator
3 participants