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

Force flake8 to the use the single-threaded pool. #505

Draft
wants to merge 1 commit into
base: rolling
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ament_flake8/ament_flake8/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ def generate_flake8_report(config_file, paths, excludes, max_line_length=None):
if max_line_length is not None:
flake8_argv.append('--max-line-length={0}'.format(max_line_length))

# We've seen some problems, especially on RHEL-9, where using the multi-threaded
# pool in flake8 can cause the Python interpreter to crash. Force flake8 to use
# the single-threaded pool here. This has some performance implications for
# large codebases, but given the distributed nature of ROS packages this shouldn't
# generally be a large problem.
flake8_argv.append('-j=1')

Comment on lines +267 to +273

Choose a reason for hiding this comment

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

@clalancette just idea, can we do something like this? we have never seen this issue with other platform.

Suggested change
# We've seen some problems, especially on RHEL-9, where using the multi-threaded
# pool in flake8 can cause the Python interpreter to crash. Force flake8 to use
# the single-threaded pool here. This has some performance implications for
# large codebases, but given the distributed nature of ROS packages this shouldn't
# generally be a large problem.
flake8_argv.append('-j=1')
import platform
if platform.system() == "Linux" and "el9" in platform.version():
# We've seen some problems, especially on RHEL-9, where using the multi-threaded
# pool in flake8 can cause the Python interpreter to crash. Force flake8 to use
# the single-threaded pool here. This has some performance implications for
# large codebases, but given the distributed nature of ROS packages this shouldn't
# generally be a large problem.
flake8_argv.append('-j=1')

style = get_flake8_style_guide(flake8_argv)

# Monkey patch formatter to collect all errors
Expand Down