Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
def remove_state_file():
    state.clear()
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)