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

#1470 setup spawn method for creating subprocesses #1510

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

import multiprocessing as mp
from concurrent.futures import Executor, ProcessPoolExecutor
from functools import partial
from threading import Lock
Expand All @@ -33,9 +34,8 @@ def __init__(self, orchestrator: _AbstractOrchestrator, subproc_initializer: Opt
super().__init__(orchestrator)
max_workers = Config.job_config.max_nb_of_workers or self._DEFAULT_MAX_NB_OF_WORKERS
self._executor: Executor = ProcessPoolExecutor(
max_workers=max_workers,
initializer=subproc_initializer,
) # type: ignore
max_workers=max_workers, initializer=subproc_initializer, mp_context=mp.get_context("spawn")
)
self._nb_available_workers = self._executor._max_workers # type: ignore

def _can_execute(self) -> bool:
Expand Down
Loading