MCPcopy Create free account
hub / github.com/CloudOrc/SolidUI / cleanup_spawned_processes

Function cleanup_spawned_processes

solidui/kernel_program/kernel_manager.py:62–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60
61
62def cleanup_spawned_processes():
63 logger.info("Cleaning up kernels...")
64 for filename in os.listdir(config.KERNEL_PID_DIR):
65 fp = os.path.join(config.KERNEL_PID_DIR, filename)
66 if os.path.isfile(fp):
67 try:
68 pid = int(filename.split(".pid")[0])
69 logger.debug("Killing process with pid %s" % pid)
70 os.remove(fp)
71 try:
72 if os.name == "nt":
73 os.kill(pid, signal.CTRL_BREAK_EVENT)
74 else:
75 os.kill(pid, signal.SIGKILL)
76
77 # After successful kill, cleanup pid file
78 os.remove(fp)
79
80 except Exception:
81 # Windows process killing is flaky
82 pass
83 except Exception as e:
84 logger.debug(e)
85
86
87def start_snakemq(kc):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected