Show More
@@ -105,9 +105,10 b' class AdminProcessManagementView(BaseApp' | |||
|
105 | 105 | def process_management_signal(self): |
|
106 | 106 | pids = self.request.json.get('pids', []) |
|
107 | 107 | result = [] |
|
108 | ||
|
108 | 109 | def on_terminate(proc): |
|
109 | 110 | msg = "process `PID:{}` terminated with exit code {}".format( |
|
110 | proc.pid, proc.returncode) | |
|
111 | proc.pid, proc.returncode or 0) | |
|
111 | 112 | result.append(msg) |
|
112 | 113 | |
|
113 | 114 | procs = [] |
@@ -121,15 +122,22 b' class AdminProcessManagementView(BaseApp' | |||
|
121 | 122 | |
|
122 | 123 | children = proc.children(recursive=True) |
|
123 | 124 | if children: |
|
124 |
|
|
|
125 | log.warning('Wont kill Master Process') | |
|
125 | 126 | else: |
|
126 | 127 | procs.append(proc) |
|
127 | 128 | |
|
128 | 129 | for p in procs: |
|
130 | try: | |
|
129 | 131 | p.terminate() |
|
132 | except psutil.AccessDenied as e: | |
|
133 | log.warning('Access denied: {}'.format(e)) | |
|
134 | ||
|
130 | 135 | gone, alive = psutil.wait_procs(procs, timeout=10, callback=on_terminate) |
|
131 | 136 | for p in alive: |
|
137 | try: | |
|
132 | 138 | p.kill() |
|
139 | except psutil.AccessDenied as e: | |
|
140 | log.warning('Access denied: {}'.format(e)) | |
|
133 | 141 | |
|
134 | 142 | return {'result': result} |
|
135 | 143 |
General Comments 0
You need to be logged in to leave comments.
Login now