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

lint multiprocessing pool shutdown #3869

Merged
merged 1 commit into from
Oct 31, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -425,3 +425,5 @@ contributors:
* Giuseppe Valente: contributor

* Takashi Hirashima: contributor

* Joffrey Mander: contributor
6 changes: 5 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ What's New in Pylint 2.6.1?
===========================
Release date: TBA

* Fix linter multiprocessing pool shutdown (triggered warnings when runned in parallels with other pytest plugins)

Closes #3779
manderj marked this conversation as resolved.
Show resolved Hide resolved

* Fix a false-positive emission of `no-self-use` and `unused-argument` for methods
of generic structural types (`Protocol[T]`)

Expand All @@ -23,7 +27,7 @@ Release date: TBA
* Fix bug that lead to duplicate messages when using ``--jobs 2`` or more.

Close #3584

* Adds option ``check-protected-access-in-special-methods`` in the ClassChecker to activate/deactivate
``protected-access`` message emission for single underscore prefixed attribute in special methods.

Expand Down
2 changes: 2 additions & 0 deletions doc/whatsnew/2.6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ New checkers
Other Changes
=============

* Fix linter multiprocessing pool shutdown which triggered warnings when runned in parallels with other pytest plugins.

* Enums are now required to be named in UPPER_CASE by ``invalid-name``.

* Fix bug that lead to duplicate messages when using ``--jobs 2`` or more.
Expand Down
18 changes: 11 additions & 7 deletions pylint/lint/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,16 @@ def check_parallel(linter, jobs, files, arguments=None):
# is identical to the linter object here. This is requred so that
# a custom PyLinter object can be used.
initializer = functools.partial(_worker_initialize, arguments=arguments)
with multiprocessing.Pool(jobs, initializer=initializer, initargs=[linter]) as pool:
# ..and now when the workers have inherited the linter, the actual reporter
# can be set back here on the parent process so that results get stored into
# correct reporter
linter.set_reporter(original_reporter)
linter.open()
pool = multiprocessing.Pool(jobs, initializer=initializer, initargs=[linter])
# ..and now when the workers have inherited the linter, the actual reporter
# can be set back here on the parent process so that results get stored into
# correct reporter
linter.set_reporter(original_reporter)
linter.open()

all_stats = []
all_stats = []

try:
for (
module,
file_path,
Expand All @@ -116,6 +117,9 @@ def check_parallel(linter, jobs, files, arguments=None):

all_stats.append(stats)
linter.msg_status |= msg_status
finally:
pool.close()
pool.join()

linter.stats = _merge_stats(all_stats)

Expand Down