예제 #1
0
    def flush(self):
        """

        :type self: StringIONotifying or StringIO
        """
        StringIO.flush(self)
        self.listener()
예제 #2
0
파일: console.py 프로젝트: keithmork/taurus
    def __init__(self, listener):
        """

        :type self: StringIO
        """
        StringIO.__init__(self)  # pylint: disable=non-parent-init-called
        self.listener = listener
예제 #3
0
    def __init__(self, listener):
        """

        :type self: StringIO
        """
        StringIO.__init__(self)
        self.listener = listener
예제 #4
0
    def __init__(self, listener):
        """

        :type self: StringIO
        """
        StringIO.__init__(self)  # pylint: disable=non-parent-init-called
        self.listener = listener
예제 #5
0
파일: console.py 프로젝트: vasischev/taurus
    def __init__(self, listener):
        """

        :type self: StringIO
        """
        StringIO.__init__(self)
        self.listener = listener
예제 #6
0
    def flush(self):
        """

        :type self: StringIONotifying or StringIO
        """
        StringIO.flush(self)
        self.listener()
예제 #7
0
    def flush(self):
        """

        :type self: StringIONotifying or StringIO
        """
        # noinspection PyArgumentList
        StringIO.flush(self)
        self.listener()
예제 #8
0
파일: console.py 프로젝트: vasischev/taurus
    def flush(self):
        """

        :type self: StringIONotifying or StringIO
        """
        # noinspection PyArgumentList
        StringIO.flush(self)
        self.listener()
예제 #9
0
    def test_reader_buffering(self):
        first_part = '{"a": 1, "b": 2}\n{"a": 2,'
        second_part = '"b": 3}\n{"a": 3, "b": 4}\n'
        reader = LDJSONReader("yip", logging.getLogger())
        buffer = StringIO(first_part)
        reader.fds = buffer

        items = list(reader.read(last_pass=False))
        self.assertEqual(len(items), 1)

        buffer.write(second_part)
        items = list(reader.read(last_pass=False))
        self.assertEqual(len(items), 2)
예제 #10
0
        def test_schedule_rps(self):
            executor = PBenchExecutor()
            executor.engine = EngineEmul()
            executor.engine.config.merge({"provisioning": "test"})
            rps = 9
            rampup = 12
            executor.execution.merge({
                "throughput": rps,
                "ramp-up": rampup,
                "steps": 3,
                "hold-for": 0
            })
            obj = Scheduler(executor.get_load(), StringIO("4 test\ntest\n"),
                            logging.getLogger(""))

            cnt = 0
            cur = 0
            currps = 0
            for item in obj.generate():
                # logging.debug("Item: %s", item)
                if int(math.ceil(item[0])) != cur:
                    # self.assertLessEqual(currps, rps)
                    cur = int(math.ceil(item[0]))
                    logging.debug("RPS: %s", currps)
                    currps = 0

                cnt += 1
                currps += 1

            logging.debug("RPS: %s", currps)
예제 #11
0
 def test_schedule_empty(self):
     executor = PBenchExecutor()
     executor.engine = EngineEmul()
     obj = Scheduler(executor.get_load(), StringIO("4 test\ntest\n"),
                     logging.getLogger(""))
     for item in obj.generate():
         logging.debug("Item: %s", item)
예제 #12
0
 def test_schedule_empty(self):
     executor = PBenchExecutor()
     executor.engine = EngineEmul()
     # concurrency: 1, iterations: 1
     obj = Scheduler(executor.get_load(), StringIO("4 test\ntest\n"),
                     logging.getLogger(""))
     items = list(obj.generate())
     for item in items:
         logging.debug("Item: %s", item)
     self.assertEqual(1, len(items))
예제 #13
0
 def test_schedule_empty(self):
     executor = PBenchExecutor()
     executor.engine = EngineEmul()
     try:
         obj = Scheduler(executor.get_load(), StringIO("4 test\ntest\n"),
                         logging.getLogger(""))
         for item in obj.generate():
             logging.debug("Item: %s", item)
         self.fail()
     except NotImplementedError:
         pass
예제 #14
0
 def test_schedule_with_no_rampup(self):
     executor = PBenchExecutor()
     executor.engine = EngineEmul()
     executor.execution.merge({
         "concurrency": 10,
         "ramp-up": None,
         "steps": 3,
         "hold-for": 10
     })
     # this line shouln't throw an exception
     obj = Scheduler(executor.get_load(), StringIO("4 test\ntest\n"),
                     logging.getLogger(""))
예제 #15
0
 def test_schedule_concurrency_steps(self):
     executor = PBenchExecutor()
     executor.engine = EngineEmul()
     executor.execution.merge({
         "concurrency": 5,
         "ramp-up": 10,
         "steps": 3
     })
     obj = Scheduler(executor.get_load(),
                     StringIO("5 test1\ntest1\n5 test2\ntest2\n"),
                     logging.getLogger(""))
     items = list(obj.generate())
     self.assertEqual(8, len(items))
     self.assertEqual(-1, items[5][0])  # instance became unlimited
     self.assertEqual(Scheduler.REC_TYPE_LOOP_START,
                      items[6][5])  # looped payload
예제 #16
0
 def test_schedule_concurrency(self):
     executor = PBenchExecutor()
     executor.engine = EngineEmul()
     executor.execution.merge({
         "concurrency": 5,
         "ramp-up": 10,
         "hold-for": 5
     })
     obj = Scheduler(executor.get_load(),
                     StringIO("5 test1\ntest1\n5 test2\ntest2\n"),
                     logging.getLogger(""))
     items = list(obj.generate())
     logging.debug("%s", items)
     self.assertEqual(8, len(items))
     self.assertEqual(-1, items[5][0])  # instance became unlimited
     self.assertEqual(1, items[6][5])  # looped payload