I have a problem where I can kill processes that spawn nodes, but the nodes are not killed. Can anyone suggest how I can do this?
Some of my last unsuccessful attempts to accomplish this:
node.terminate()
and
node.send_signal(signal.SIGINT)
Below is the code:
from subprocess import Popen import json import sys import os import signal import requests FNULL = open(os.devnull, 'w') json_data = open('nodes.json', 'r').read() data = json.loads(json_data) port = data['port']
As far as I know, I am basically forced to use shell = True to get redirects to work Handling the child stdout / stderr in the parent python process is not an option, since I could not find the functionality for this in standby mode (and the parent python process should perform other actions while the child is running)
# close nodes for node in nodes: node.send_signal(signal.SIGINT) node.terminate()
this seems to kill all processes except 1 of the nodes. Not always the same
source share