def handle(self): nodes = self.load_state() if 'all' in self.args.nodes: for node, info in nodes.iteritems(): print 'Killing node {0} with pid {1}'.format(node, info['pid']) os.kill(info['pid'], 15) state.clear() else: for node in self.args.nodes: info = nodes.pop(node) print 'Killing node {0} with pid {1}'.format(node, info['pid']) os.kill(info['pid'], 15) state.dump(nodes)
def remove_state_file(): state.clear()
def test_clear_should_remove_state_file(): state.dump({'foo': 'bar'}) assert os.path.isfile(state.filename) state.clear() assert not os.path.isfile(state.filename)