Пример #1
0
 def test_unique_connections(self):
     pool = self.get_pool()
     epool = eventlet.GreenPool()
     for i in xrange(self.NUM_ITER):
         epool.spawn_n(self.spawn_slow_network_and_query_slow_response, pool, self.SLOW_NETWORK_QUERY, 1,
                       {'value': i, i: 'value'})
     epool.waitall()
Пример #2
0
    def test_start_many_slow_connections(self):
        """ Test starting many slow connections """

        pile = eventlet.GreenPile()
        [pile.spawn(self.get_connection) for _ in xrange(self.NUM_ITER)]
        for conn in pile:
            self.assertIsInstance(conn, RexProEventletConnection)
 def test_unique_connections(self):
     pool = self.get_pool()
     epool = eventlet.GreenPool()
     for i in xrange(self.NUM_ITER):
         epool.spawn_n(self.spawn_slow_network_and_query_slow_response, pool, self.SLOW_NETWORK_QUERY, 1,
                       {'value': i, i: 'value'})
     epool.waitall()
Пример #4
0
    def test_start_many_slow_connections(self):
        """ Test starting many slow connections """

        pile = eventlet.GreenPile()
        [pile.spawn(self.get_connection) for _ in xrange(self.NUM_ITER)]
        for conn in pile:
            self.assertIsInstance(conn, RexProEventletConnection)
Пример #5
0
        def test_start_many_connections(self):
            """ Test starting up many connections """

            gevent.joinall([
                gevent.spawn(self.get_connection)
                for _ in xrange(self.NUM_ITER)
            ],
                           timeout=3)
Пример #6
0
        def test_start_many_slow_connections(self):
            """ Test starting many slow connections """

            gevent.joinall([
                gevent.spawn(slow_start_simulation, self)
                for _ in xrange(self.NUM_ITER)
            ],
                           timeout=3)
Пример #7
0
        def test_unique_connections(self):
            pool = self.get_pool()
            threads = []
            for i in xrange(self.NUM_ITER):
                threads.append(
                    gevent.spawn(self.spawn_slow_network_and_query_slow_response,
                                 pool, self.SLOW_NETWORK_QUERY, 1, {'value': i, i: 'value'})
                )

            gevent.joinall(threads, timeout=5)
Пример #8
0
        def test_unique_connections(self):
            pool = self.get_pool()
            threads = []
            for i in xrange(self.NUM_ITER):
                threads.append(
                    gevent.spawn(self.spawn_slow_network_and_query_slow_response,
                                 pool, self.SLOW_NETWORK_QUERY, 1, {'value': i, i: 'value'})
                )

            gevent.joinall(threads, timeout=5)
Пример #9
0
        def test_many_network_calls(self):
            """ Test known responses on a network that should be slow, we should get them all asynchronously """

            threads = []

            for i in xrange(self.NUM_ITER):
                threads.append(
                    gevent.spawn(spawn_slow_network_and_query_slow_response,
                                 self, self.SLOW_NETWORK_QUERY, 1, {
                                     'value': i,
                                     i: 'value'
                                 }))

            gevent.joinall(threads, timeout=5)
Пример #10
0
    def test_many_network_calls(self):
        """ Test known responses on a network that should be slow, we should get them all asynchronously """

        pile = eventlet.GreenPile()

        for i in xrange(self.NUM_ITER):
            pile.spawn(spawn_slow_network_and_query_slow_response, self,
                       self.SLOW_NETWORK_QUERY, 1, {
                           'value': i,
                           i: 'value'
                       })

        for result in pile:
            print_(result)
            self.assertIsInstance(result, dict)
Пример #11
0
        def test_many_network_calls(self):
            """ Test known responses on a network that should be slow, we should get them all asynchronously """

            threads = []

            for i in xrange(self.NUM_ITER):
                threads.append(gevent.spawn(spawn_slow_network_and_query_slow_response,
                                            self,
                                            self.SLOW_NETWORK_QUERY,
                                            1,
                                            {'value': i, i: 'value'}
                                            )
                               )

            gevent.joinall(threads, timeout=5)
Пример #12
0
    def test_many_network_calls(self):
        """ Test known responses on a network that should be slow, we should get them all asynchronously """

        pile = eventlet.GreenPile()

        for i in xrange(self.NUM_ITER):
            pile.spawn(spawn_slow_network_and_query_slow_response,
                       self,
                       self.SLOW_NETWORK_QUERY,
                       1,
                       {'value': i, i: 'value'}
                       )

        for result in pile:
            print_(result)
            self.assertIsInstance(result, dict)
Пример #13
0
 def test_many_concurrent_connections(self):
     pool = self.get_pool()
     epool = eventlet.GreenPool()
     for _ in xrange(self.NUM_ITER):
         epool.spawn_n(pool.create_connection)
     epool.waitall()
 def test_many_concurrent_connections(self):
     pool = self.get_pool()
     epool = eventlet.GreenPool()
     for _ in xrange(self.NUM_ITER):
         epool.spawn_n(pool.create_connection)
     epool.waitall()
Пример #15
0
 def test_many_concurrent_connections(self):
     pool = self.get_pool()
     gevent.joinall([
         gevent.spawn(pool.create_connection)
         for _ in xrange(self.NUM_ITER)
     ])
Пример #16
0
 def test_many_concurrent_connections(self):
     pool = self.get_pool()
     pile = eventlet.GreenPile()
     [pile.spawn(pool.create_connection) for _ in xrange(self.NUM_ITER)]
Пример #17
0
        def test_start_many_slow_connections(self):
            """ Test starting many slow connections """

            gevent.joinall([gevent.spawn(slow_start_simulation, self) for _ in xrange(self.NUM_ITER)], timeout=3)
Пример #18
0
        def test_start_many_connections(self):
            """ Test starting up many connections """

            gevent.joinall([gevent.spawn(self.get_connection) for _ in xrange(self.NUM_ITER)], timeout=3)
Пример #19
0
if __name__ == '__main__':
    import tasks
    from rexpro._compat import print_, xrange
    print_("Queuing up tasks...")
    SLOW_NETWORK_QUERY = """def test_slow_query(sleep_time, value) {
    sleep sleep_time
    return value
    }

    return test_slow_query(sleep_length, data)
    """

    NUM_QUERIES = 10000
    SLEEP_TIME = 1
    script_params_pairs = [(SLOW_NETWORK_QUERY, {'sleep_length': SLEEP_TIME, 'data': i}) for i in xrange(NUM_QUERIES)]

    results = tasks.start_massive_queries(script_params_pairs)
    print_("Got Results:")
    print_(results)

else:
    print_("This must be executed manually")
Пример #20
0
 def test_many_concurrent_connections(self):
     pool = self.get_pool()
     gevent.joinall([
         gevent.spawn(pool.create_connection) for _ in xrange(self.NUM_ITER)
     ])
 def test_many_concurrent_connections(self):
     pool = self.get_pool()
     pile = eventlet.GreenPile()
     [pile.spawn(pool.create_connection) for _ in xrange(self.NUM_ITER)]