Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(57)  |  Call(7)  |  Derive(44)  |  Import(6)
Pool class implements resource limitation and construction.

There are two ways of using Pool: passing a `create` argument or
subclassing. In either case you must provide a way to create
the resource.

When using `create` argument, pass a function with no arguments::

    http_pool = pools.Pool(create=httplib2.Http)
(more...)

src/s/y/synaps-HEAD/synaps/rpc/__init__.py   synaps(Download)
 
from eventlet import semaphore
from eventlet.pools import Pool
from synaps import flags
from synaps.utils import strtime
    def __init__(self):
        alarm_rpc_connection = lambda : RpcConnection(True)
        self.metric_pool = Pool(create=RpcConnection, max_size=500)
        self.alarm_pool = Pool(create=alarm_rpc_connection, max_size=20)
 

src/h/o/hortonworks-sandbox-HEAD/desktop/core/ext-py/eventlet-0.9.14/eventlet/db_pool.py   hortonworks-sandbox(Download)
from collections import deque
import sys
import time
 
from eventlet.pools import Pool
class BaseConnectionPool(Pool):
    def __init__(self, db_module,
                       min_size = 0, max_size = 4,
                       max_idle = 10, max_age = 30,
                       connect_timeout = 5,

src/e/v/eventlet-0.14.0/eventlet/db_pool.py   eventlet(Download)
from collections import deque
import sys
import time
 
from eventlet.pools import Pool
class BaseConnectionPool(Pool):
    def __init__(self, db_module,
                       min_size = 0, max_size = 4,
                       max_idle = 10, max_age = 30,
                       connect_timeout = 5,

src/e/v/eventlet-HEAD/eventlet/db_pool.py   eventlet(Download)
import time
 
from eventlet.pools import Pool
from eventlet import timeout
from eventlet import hubs
class BaseConnectionPool(Pool):
    def __init__(self, db_module,
                       min_size = 0, max_size = 4,
                       max_idle = 10, max_age = 30,
                       connect_timeout = 5,

src/e/v/eventlet-0.14.0/tests/pools_test.py   eventlet(Download)
class IntPool(pools.Pool):
    def create(self):
        self.current_integer = getattr(self, 'current_integer', 0) + 1
        return self.current_integer
 
            return "slept"
 
        p = pools.Pool(max_size=4, create=sleep_create)
 
        def do_get():
    def test_abstract(self):
        ## Going for 100% coverage here
        ## A Pool cannot be used without overriding create()
        pool = pools.Pool()
        self.assertRaises(NotImplementedError, pool.get)
class RaisePool(pools.Pool):
    def create(self):
        raise RuntimeError()
 
 

src/h/o/hortonworks-sandbox-HEAD/desktop/core/ext-py/eventlet-0.9.14/eventlet/processes.py   hortonworks-sandbox(Download)
class ProcessPool(pools.Pool):
    def __init__(self, command, args=None, min_size=0, max_size=4):
        """*command*
            the command to run
        """

src/e/v/eventlet-HEAD/tests/pools_test.py   eventlet(Download)
class IntPool(pools.Pool):
    def create(self):
        self.current_integer = getattr(self, 'current_integer', 0) + 1
        return self.current_integer
 
            return "slept"
 
        p = pools.Pool(max_size=4, create=sleep_create)
 
        def do_get():
    def test_abstract(self):
        ## Going for 100% coverage here
        ## A Pool cannot be used without overriding create()
        pool = pools.Pool()
        self.assertRaises(NotImplementedError, pool.get)
class RaisePool(pools.Pool):
    def create(self):
        raise RuntimeError()
 
 

src/e/v/eventlet-0.14.0/eventlet/processes.py   eventlet(Download)
class ProcessPool(pools.Pool):
    def __init__(self, command, args=None, min_size=0, max_size=4):
        """*command*
            the command to run
        """

src/e/v/eventlet-HEAD/eventlet/processes.py   eventlet(Download)
class ProcessPool(pools.Pool):
    def __init__(self, command, args=None, min_size=0, max_size=4):
        """*command*
            the command to run
        """

src/s/w/swift-HEAD/swift/common/memcached.py   swift(Download)
 
from eventlet.green import socket
from eventlet.pools import Pool
from eventlet import Timeout, __version__ as eventlet_version
 
class MemcacheConnPool(Pool):
    """Connection pool for Memcache Connections"""
 
    def __init__(self, server, size, connect_timeout):
        Pool.__init__(self, max_size=size)

  1 | 2 | 3 | 4 | 5  Next