MCPcopy
hub / github.com/ModelTC/LightLLM / start_submodule_processes

Method start_submodule_processes

lightllm/utils/start_utils.py:13–41  ·  view source on GitHub ↗
(self, start_funcs=[], start_args=[])

Source from the content-addressed store, hash-verified

11 self.processes = []
12
13 def start_submodule_processes(self, start_funcs=[], start_args=[]):
14 assert len(start_funcs) == len(start_args)
15 pipe_readers = []
16 processes = []
17
18 for start_func, start_arg in zip(start_funcs, start_args):
19 pipe_reader, pipe_writer = mp.Pipe(duplex=False)
20 process = mp.Process(
21 target=start_func,
22 args=start_arg + (pipe_writer,),
23 )
24 process.start()
25 pipe_readers.append(pipe_reader)
26 processes.append(process)
27
28 # Wait for all processes to initialize
29 for index, pipe_reader in enumerate(pipe_readers):
30 init_state = pipe_reader.recv()
31 if init_state != "init ok":
32 logger.error(f"init func {start_funcs[index].__name__} : {str(init_state)}")
33 for proc in processes:
34 proc.kill()
35 sys.exit(1)
36 else:
37 logger.info(f"init func {start_funcs[index].__name__} : {str(init_state)}")
38
39 assert all([proc.is_alive() for proc in processes])
40 self.processes.extend(processes)
41 return
42
43 def terminate_all_processes(self):
44 from lightllm.utils.envs_utils import get_env_start_args

Callers 2

normal_or_p_d_startFunction · 0.80
pd_master_startFunction · 0.80

Calls 3

startMethod · 0.80
recvMethod · 0.80
extendMethod · 0.45

Tested by

no test coverage detected