Skip to content

Commit

Permalink
core: use mp context
Browse files Browse the repository at this point in the history
as once called the multiprocessing module
refuses to change the defaults

Signed-off-by: Konrad Weihmann <[email protected]>
  • Loading branch information
priv-kweihmann committed Mar 3, 2025
1 parent d53eacb commit 9c5beab
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions oelint_adv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,8 @@ def rule_applicable(rule):
# But in our setup we will need to share e.g. the CONSTANTS object into
# the checks running in the Pool
# Hence, we enforce fork
if mp.get_start_method() != 'fork':
mp.set_start_method('fork') # pragma: no cover
with mp.Pool(processes=min(args.jobs, len(groups))) as pool:
ctx = mp.get_context('fork')
with ctx.Pool(processes=min(args.jobs, len(groups))) as pool:
try:
issues = flatten(pool.map(partial(group_run, quiet=args.quiet, fix=args.fix,
rules=rules, state=args.state), groups))
Expand Down

0 comments on commit 9c5beab

Please sign in to comment.