From b714d0e2eb95893d1f3f4b3b2a6b1434fe67fee7 Mon Sep 17 00:00:00 2001 From: Giovanni M Guidini <99758426+giovanni-guidini@users.noreply.github.com> Date: Thu, 16 Mar 2023 16:46:42 +0100 Subject: [PATCH] Gio/release with static analysis (#110) * Fix issue missing tree_sitter_python * Explicitly make FORK the multiprocessing option to choose This is because in the MacOS release build (at least) I keep seeing errors like: ``` Error: No such option: --multiprocessing-fork Usage: main [OPTIONS] COMMAND [ARGS]... Try 'main --help' for help. Error: No such option: -B Usage: main [OPTIONS] COMMAND [ARGS]... Try 'main --help' for help. ``` Which are from instantiating new processes, for sure. This SO question: https://stackoverflow.com/questions/67999589/multiprocessing-with-pool-throws-error-on-m1-macbook Indicates it might be the way it creates new processes and suggests using "fork" explicitly. We're giving that a go. --- codecov_cli/services/staticanalysis/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codecov_cli/services/staticanalysis/__init__.py b/codecov_cli/services/staticanalysis/__init__.py index 72f8c77d..8e91e203 100644 --- a/codecov_cli/services/staticanalysis/__init__.py +++ b/codecov_cli/services/staticanalysis/__init__.py @@ -3,7 +3,7 @@ import logging import typing from functools import partial -from multiprocessing import Pool +from multiprocessing import get_context from pathlib import Path import click @@ -41,7 +41,7 @@ async def run_analysis_entrypoint( length=len(files), label="Analyzing files", ) as bar: - with Pool(processes=numberprocesses) as pool: + with get_context("fork").Pool(processes=numberprocesses) as pool: file_results = pool.imap_unordered(mapped_func, files) for x in file_results: bar.update(1, x)