Closed saily closed 9 years ago
@datakurre can you test this branch and provide feedback?
@saily Thanks. Next I need to check, what enables multiprocessing in flake8, and maybe then figure out, how to fix my Python :/
➜ plone.app.blocks git:(static-layouts) ✗ bin/code-analysis
Flake8..........................[ FAILURE ] in 0.279s
Traceback (most recent call last):
File "/.../bin/flake8", line 19, in <module>
sys.exit(flake8.main.main())
File "/.../flake8-2.4.1-py2.7.egg/flake8/main.py", line 25, in main
flake8_style = get_style_guide(parse_argv=True, config_file=DEFAULT_CONFIG)
File "/.../flake8-2.4.1-py2.7.egg/flake8/engine.py", line 163, in get_style_guide
report = styleguide.init_report(reporter)
File "/.../pep8-1.5.7-py2.7.egg/pep8.py", line 1657, in init_report
self.options.report = (reporter or self.options.reporter)(self.options)
File "/.../pep8-1.5.7-py2.7.egg/pep8.py", line 1559, in __init__
super(StandardReport, self).__init__(options)
File "/.../eggs/flake8-2.4.1-py2.7.egg/flake8/reporter.py", line 28, in __init__
self.task_queue = multiprocessing.Queue()
File "/.../lib/python2.7/multiprocessing/__init__.py", line 217, in Queue
from multiprocessing.queues import Queue
File "/.../lib/python2.7/multiprocessing/queues.py", line 48, in <module>
from .synchronize import Lock, BoundedSemaphore, Semaphore, Condition
File "/.../lib/python2.7/multiprocessing/synchronize.py", line 59, in <module>
" function, see issue 3770.")
ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.
The command "bin/code-analysis" exited with 1 in 0.279s.
@saily My anothert issue with flake8 could be fixed, by explicitly giving flake8 option --jobs=1. Would that make sense in p.r.codeanalysis when multiprocessing=False?
if multiprocessing:
parser.config_options.append('jobs')
parser.add_option('-j', '--jobs', type='string', default='auto',
help="number of jobs to run simultaneously, "
"or 'auto'. This is ignored on Windows.")
(I have no idea, why "auto" resolves to "2" on my machine.)
i agree, makes sense but not related to this issue, anyway, i will try to fix this in this pull as well. i'll ping you later...
@saily Figured it out. To summarize, flake8 has similar issue (it only checks availability of multiprocessing module and not if it really works, and defaults to jobs==available cores, which is 2 on my machine, even multiprocessing is broken on my Python), but flake8 issue could be avoided by explicitly settings jobs=1 in plone.recipe.codeanalysis when multiprocessing=False.
@saily It seems, I can also configure flake8-jobs = 1
for codeanalysis, so while defaulting to 1 when multiprocessing=False would be convenient, it's not critical.
@saily So, this fix works. Yet, if you would agree that having flake8-jobs to explicitly default 1 when multiprocessing is False, it would be very convenient.
@datakurre hopefully this will fix your issue.
It does. Thanks.
This tries to fix #151.