예제 #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)
예제 #2
0
def remove_state_file():
    state.clear()
예제 #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)
예제 #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)