Skip to content

Commit

Permalink
Use context for process start method (#310)
Browse files Browse the repository at this point in the history
MarkintoshZ authored Jan 19, 2024
1 parent c941fe4 commit 72df2ce
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions acto/runner/runner.py
Original file line number Diff line number Diff line change
@@ -81,8 +81,7 @@ def __init__(
"role_binding": self.rbac_authorization_v1_api.list_namespaced_role_binding,
}

if multiprocessing.get_start_method() != "fork":
multiprocessing.set_start_method("fork")
self.mp_ctx = multiprocessing.get_context("fork")

self._custom_system_state_f = custom_system_state_f

@@ -441,13 +440,11 @@ def wait_for_system_converge(self, hard_timeout=480) -> bool:
self.namespace, _preload_content=False, watch=True
)

combined_event_queue: multiprocessing.Queue = multiprocessing.Queue(
maxsize=0
)
combined_event_queue = self.mp_ctx.Queue(maxsize=0)
timer_hard_timeout = acto_timer.ActoTimer(
hard_timeout, combined_event_queue, "timeout"
)
watch_process = multiprocessing.Process(
watch_process = self.mp_ctx.Process(
target=self.watch_system_events,
args=(event_stream, combined_event_queue),
)

0 comments on commit 72df2ce

Please sign in to comment.