def spawn_processes(log, args): """ Launch the subprocesses and hang until completion. """ shared = SharedState() log.info("Spawning RPC process...") _PROCESSES.append( mpm.spawn_rpc_process(mpm.mpmtypes.MPM_RPC_PORT, shared, args.default_args)) log.debug("RPC process has PID: %d", _PROCESSES[-1].pid) if watchdog.has_watchdog(): watchdog.transfer_control(_PROCESSES[-1].pid) log.info("Spawning discovery process...") _PROCESSES.append(mpm.spawn_discovery_process(shared, args.discovery_addr)) log.debug("Discovery process has PID: %d", _PROCESSES[-1].pid) log.info("Processes launched. Registering signal handlers.") # Launch the kill thread # This is used because we cannot block in a signal handler, # meaning we cannot join threads Thread(target=kill_thread, daemon=False).start() signal.signal(signal.SIGTERM, kill_time) signal.signal(signal.SIGINT, kill_time) if JOIN_PROCESSES: for proc in _PROCESSES: proc.join() return True
def spawn_processes(log, args): """ Launch the subprocesses and hang until completion. """ shared = SharedState() log.info("Spawning RPC process...") _PROCESSES.append( mpm.spawn_rpc_process(mpm.mpmtypes.MPM_RPC_PORT, shared, args.default_args)) log.debug("RPC process has PID: %d", _PROCESSES[-1].pid) if watchdog.has_watchdog(): watchdog.transfer_control(_PROCESSES[-1].pid) log.info("Spawning discovery process...") _PROCESSES.append(mpm.spawn_discovery_process(shared, args.discovery_addr)) log.debug("Discovery process has PID: %d", _PROCESSES[-1].pid) log.info("Processes launched. Registering signal handlers.") signal.signal(signal.SIGTERM, kill_time) signal.signal(signal.SIGINT, kill_time) for proc in _PROCESSES: proc.join() return True
def spawn_processes(log, args): """ Launch the subprocesses and hang until completion. """ shared = SharedState() log.info("Spawning RPC process...") _PROCESSES.append( mpm.spawn_rpc_process( mpm.mpmtypes.MPM_RPC_PORT, shared, args.default_args)) log.debug("RPC process has PID: %d", _PROCESSES[-1].pid) if watchdog.has_watchdog(): watchdog.transfer_control(_PROCESSES[-1].pid) log.info("Spawning discovery process...") _PROCESSES.append( mpm.spawn_discovery_process(shared, args.discovery_addr) ) log.debug("Discovery process has PID: %d", _PROCESSES[-1].pid) log.info("Processes launched. Registering signal handlers.") signal.signal(signal.SIGTERM, kill_time) signal.signal(signal.SIGINT, kill_time) for proc in _PROCESSES: proc.join() return True