Skip to content

Commit

Permalink
refactor: fix run stateful in docker (#6116)
Browse files Browse the repository at this point in the history
Signed-off-by: Joan Martinez <[email protected]>
Co-authored-by: Joan Martinez <[email protected]>
  • Loading branch information
JoanFM and JoanFM authored Nov 24, 2023
1 parent 7aab7e6 commit ed70797
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions jina/serve/executors/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def _set_envs():
finally:
_unset_envs()
is_shutdown.set()
logger.debug(f'process terminated')
logger.debug('process terminated')


def run_stateful(args: 'argparse.Namespace',
Expand All @@ -181,6 +181,7 @@ def run_stateful(args: 'argparse.Namespace',
is_ready = multiprocessing.Event()
is_shutdown = multiprocessing.Event()
is_started = multiprocessing.Event()
is_signal_handlers_installed = multiprocessing.Event()
raft_worker = multiprocessing.Process(
target=run_raft,
kwargs={
Expand All @@ -192,10 +193,12 @@ def run_stateful(args: 'argparse.Namespace',
)
cargs = copy.deepcopy(args)

from jina.constants import RAFT_TO_EXECUTOR_PORT

if isinstance(cargs.port, int):
cargs.port += 1
cargs.port += RAFT_TO_EXECUTOR_PORT
elif isinstance(cargs.port, list):
cargs.port = [port + 1 for port in cargs.port]
cargs.port = [port + RAFT_TO_EXECUTOR_PORT for port in cargs.port]
worker = multiprocessing.Process(
target=run,
kwargs={
Expand All @@ -205,6 +208,7 @@ def run_stateful(args: 'argparse.Namespace',
'is_started': is_started,
'is_shutdown': is_shutdown,
'is_ready': is_ready,
'is_signal_handlers_installed': is_signal_handlers_installed,
'runtime_cls': runtime_cls,
'jaml_classes': JAML.registered_classes(),
},
Expand Down

0 comments on commit ed70797

Please sign in to comment.