Ejemplo n.º 1
0
    def test_interrupted_and_terminated(self):
        script = script_executor.Script(**self.DATA)
        script.start()
        state = script.state()
        script.wait()  # wait termination

        restored = script_executor.Script(**state)
        self.assert_wait(restored)
Ejemplo n.º 2
0
    def test_interrupted_and_running(self):
        script = script_executor.Script(**self.DATA)
        script.start()

        state = script.state()
        assert state['id']
        assert state['pid']
        assert type(state['start_time']) == float
        assert state['interpreter']

        restored = script_executor.Script(**state)

        self.assert_wait(restored)
Ejemplo n.º 3
0
    def _exec_script(self, name=None, body=None, exec_timeout=None):
        if not self._script_executor:
            self._script_executor = script_executor.get_handlers()[0]

        self._logger.info('Executing %s script', name)
        kwargs = dict(name=name, body=body, exec_timeout=exec_timeout or 3600)
        self._script_executor.execute_scripts(scripts=(script_executor.Script(
            **kwargs), ))
Ejemplo n.º 4
0
    def test_ok(self):
        script = script_executor.Script(**self.DATA)
        script.start()
        assert type(script.pid) == int
        assert script.interpreter == '/usr/bin/python'
        assert script.exec_path.startswith('/')
        assert script.stderr_path.startswith('/')
        assert script.stdout_path.startswith('/')

        self.assert_wait(script)
Ejemplo n.º 5
0
    def test_timeouted(self):
        script = script_executor.Script(**self.DATA_TIMEOUTED)
        script.start()
        data = script.wait()

        assert data['return_code'] == -9  # killed