예제 #1
0
    def __init__(self, exemplum: Exemplum) -> None:
        self._state = types.State.Stopped

        self._command_queue = commands.CommandPriorityQueue()
        self._exemplum = exemplum
        self._exemplum.set_break_callback(self.has_commands)
        self._idle_callbacks = []
예제 #2
0
    def __init__(self, pipeline: PredictionPipeline) -> None:
        self._state = types.State.Stopped

        self._command_queue = commands.CommandPriorityQueue()
        self._pipeline = pipeline
        self._pipeline.set_break_callback(self.has_commands)
        self._idle_callbacks = []
예제 #3
0
    def test_queue_order_is_stable(self):
        cmd_queue = cmds.CommandPriorityQueue()
        stop_cmds = [cmds.StopCmd() for _ in range(100)]
        for cmd in stop_cmds:
            cmd_queue.put_nowait(cmd)

        for expected_cmd in stop_cmds:
            assert expected_cmd is cmd_queue.get_nowait()
예제 #4
0
    def test_stop_command_has_higher_priorityj(self):
        cmd_queue = cmds.CommandPriorityQueue()
        stop_cmd = cmds.StopCmd()
        cmd_queue.put_nowait(cmds.ResumeCmd())
        cmd_queue.put_nowait(stop_cmd)
        cmd_queue.put_nowait(cmds.PauseCmd())

        received_cmd = cmd_queue.get_nowait()
        assert stop_cmd is received_cmd