From 7e074112b1ba4b7886bdffcdc28d2fa46620879f Mon Sep 17 00:00:00 2001 From: Amir Mofakhar Date: Thu, 31 Oct 2024 14:30:13 +0000 Subject: [PATCH] added method for setting start method as spawn --- pipelinewise/cli/multiprocess.py | 6 +++--- pipelinewise/cli/pipelinewise.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pipelinewise/cli/multiprocess.py b/pipelinewise/cli/multiprocess.py index cda693d69..07e47462f 100644 --- a/pipelinewise/cli/multiprocess.py +++ b/pipelinewise/cli/multiprocess.py @@ -9,9 +9,6 @@ class Process(multiprocessing.Process): """ def __init__(self, *args, **kwargs): multiprocessing.Process.__init__(self, *args, **kwargs) - multiprocessing.freeze_support() - multiprocessing.set_start_method('spawn', force=True) - self._pconn, self._cconn = multiprocessing.Pipe() self._exception = None @@ -31,3 +28,6 @@ def exception(self): if self._pconn.poll(): self._exception = self._pconn.recv() return self._exception + + def set_start_method_as_spawn(self): + multiprocessing.set_start_method('spawn', force=True) diff --git a/pipelinewise/cli/pipelinewise.py b/pipelinewise/cli/pipelinewise.py index 4696c1330..b2c95de18 100644 --- a/pipelinewise/cli/pipelinewise.py +++ b/pipelinewise/cli/pipelinewise.py @@ -1403,6 +1403,7 @@ def do_sync_tables(self, fastsync_stream_ids=None): self._reset_state_file_for_partial_sync(selected_tables) partial_sync_process = Process( target=self.sync_tables_partial_sync, args=(selected_tables['partial_sync'],)) + partial_sync_process.set_start_method_as_spawn() partial_sync_process.start() processes_list.append(partial_sync_process)