summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschlamar <marc.schlaich@gmail.com>2016-07-27 08:09:06 +0200
committerschlamar <marc.schlaich@gmail.com>2016-07-27 08:09:06 +0200
commit1f10ed687e964c64b9eea2ee05e6fea8054c887b (patch)
tree2f9004c83a676a74fff141aa9df513db76cc9a16 /src
parent80450ff0976784b1bf658bbc05cca5c8c8405950 (diff)
downloadflake8-1f10ed687e964c64b9eea2ee05e6fea8054c887b.tar.gz
Fix multiprocessing on Windows
Diffstat (limited to 'src')
-rw-r--r--src/flake8/checker.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/flake8/checker.py b/src/flake8/checker.py
index 09168ee..3d92b39 100644
--- a/src/flake8/checker.py
+++ b/src/flake8/checker.py
@@ -38,6 +38,14 @@ SERIAL_RETRY_ERRNOS = set([
])
+def _run_checks_from_queue(process_queue, results_queue, statistics_queue):
+ LOG.info('Running checks in parallel')
+ for checker in iter(process_queue.get, 'DONE'):
+ LOG.info('Checking "%s"', checker.filename)
+ checker.run_checks(results_queue, statistics_queue)
+ results_queue.put('DONE')
+
+
class Manager(object):
"""Manage the parallelism and checker instances for each plugin and file.
@@ -215,13 +223,6 @@ class Manager(object):
)
return reported_results_count
- def _run_checks_from_queue(self):
- LOG.info('Running checks in parallel')
- for checker in iter(self.process_queue.get, 'DONE'):
- LOG.info('Checking "%s"', checker.filename)
- checker.run_checks(self.results_queue, self.statistics_queue)
- self.results_queue.put('DONE')
-
def is_path_excluded(self, path):
# type: (str) -> bool
"""Check if a path is excluded.
@@ -309,7 +310,9 @@ class Manager(object):
LOG.info('Starting %d process workers', self.jobs)
for i in range(self.jobs):
proc = multiprocessing.Process(
- target=self._run_checks_from_queue
+ target=_run_checks_from_queue,
+ args=(self.process_queue, self.results_queue,
+ self.statistics_queue)
)
proc.daemon = True
proc.start()