Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use setcheckinterval only if python version is 3.8 since it is no longer exist in higher versions#11432

Merged
amaltaro merged 3 commits intodmwm:masterfrom
vkuznet:fix-setcheckinterval
Feb 1, 2023
Merged

Use setcheckinterval only if python version is 3.8 since it is no longer exist in higher versions#11432
amaltaro merged 3 commits intodmwm:masterfrom
vkuznet:fix-setcheckinterval

Conversation

@vkuznet
Copy link
Contributor

@vkuznet vkuznet commented Jan 10, 2023

Fixes #11310

Status

ready

Description

While I was testing WMCore code using 3.10 python on my macOS I found this issue.
The setcheckinterval is removed from python codebase, see https://bugs.python.org/issue37392

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

YES

Related PRs

External dependencies / deployment changes

@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: succeeded
    • 2 changes in unstable tests
  • Python3 Pylint check: failed
    • 16 warnings and errors that must be fixed
    • 4 warnings
    • 109 comments to review
  • Pylint py3k check: succeeded
  • Pycodestyle check: succeeded
    • 37 comments to review

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

@vkuznet vkuznet requested a review from amaltaro January 31, 2023 13:03
@vkuznet
Copy link
Contributor Author

vkuznet commented Jan 31, 2023

Alan, could you please review and merge this PR. It is one of the issue preventing from testing WMCore code in local (laptop) environment using different than 3.8 version of python.

cpconfig.update({'request.methods_with_bodies': ("POST", "PUT", "DELETE")})
_thread.stack_size(getattr(self.srvconfig, 'thread_stack_size', 128 * 1024))
sys.setcheckinterval(getattr(self.srvconfig, 'sys_check_interval', 10000))
if sys.version_info.major == 3 and sys.version_info.minor == 8:
Copy link
Contributor

Choose a reason for hiding this comment

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

Valentin, according to the documentation:
https://docs.python.org/3.8/library/sys.html#sys.setcheckinterval

it has no effect since python 3.2.

So, I think we have two options here:
a) completely remove this check_interval hook; or
b) replace it according to what is suggested in the official documentation: https://docs.python.org/3.8/library/sys.html#sys.setswitchinterval

It's not 100% clear to me whether the unit (secs) is the same between checkinterval and switchinterval. But I'd be inclined to proceed with option b).

@amaltaro
Copy link
Contributor

amaltaro commented Feb 1, 2023

@vkuznet as we discussed this morning, a friendly ping in case you missed this notification.

@mapellidario Hi Dario, I do not know if you guys have a similar code somewhere in the Analysis realm, but I am tagging you here just in case ;)

@vkuznet
Copy link
Contributor Author

vkuznet commented Feb 1, 2023

Alan, I already replied (but it is listed as pending), anyway here is my reply again:

Well, here is how sys.setcheckinginterval: described in documentation

sys.setcheckinterval(interval)
Set the interpreter’s “check interval”. This integer value determines how often the interpreter checks for periodic things such as thread switches and signal handlers. The default is 100, meaning the check is performed every 100 Python virtual instructions. Setting it to a larger value may increase performance for programs using threads. Setting it to a value <= 0 checks every virtual instruction, maximizing responsiveness as well as overhead.

Therefore, I need to know which interval value to use if we'll go option (b) because the current one is in virtual instructions while latter is in seconds. Here is my proposal:

        interval = getattr(self.srvconfig, 'sys_check_i``nterval', 10000)
        sys.setswitchinterval(interval/1000)

Is it acceptable?

@amaltaro
Copy link
Contributor

amaltaro commented Feb 1, 2023

Yes, I would keep exactly the same logic as before, just updating the method names.
Honestly, we need to keep an eye on it, given that the documentation is not very explicit with the units (what is the correlation of second to virtual instruction?) Anyways, something to observe in testbed.

amaltaro and others added 2 commits February 1, 2023 15:04
Use setcheckinterval only if python version is 3.8 since it is no longer exist in higher versions
@vkuznet vkuznet force-pushed the fix-setcheckinterval branch from dfcc581 to a1f0622 Compare February 1, 2023 20:05
@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: failed
    • 2 new failures
    • 1 tests no longer failing
  • Python3 Pylint check: failed
    • 16 warnings and errors that must be fixed
    • 4 warnings
    • 109 comments to review
  • Pylint py3k check: succeeded
  • Pycodestyle check: succeeded
    • 38 comments to review

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

@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: succeeded
    • 1 tests no longer failing
  • Python3 Pylint check: failed
    • 16 warnings and errors that must be fixed
    • 4 warnings
    • 109 comments to review
  • Pylint py3k check: succeeded
  • Pycodestyle check: succeeded
    • 38 comments to review

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

@amaltaro amaltaro self-requested a review February 1, 2023 23:07
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 Valentin!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Dockerfiles to build image from PyPi packages, deprecating the RPM model

3 participants