Exemple #1
0
def test(calls=100):
    results = []
    pool = ThreadPool(9)
    for n in range(calls):
        pool.run(fn1, n, results)
    while len(results) < calls:
        sleep(1)
    print 'shutdown pool...'
    pool.shutdown()
Exemple #2
0
 def __init__(self, plugin):
     """
     :param plugin: A real plugin.
     :type plugin: gofer.agent.plugin.Plugin
     """
     Admin.container = plugin.container
     self.pool = ThreadPool(3)
     self.dispatcher = self._dispatcher()
     self.plugin = plugin
     self.latency = 0
Exemple #3
0
 def __init__(self, descriptor, path):
     """
     :param descriptor: The plugin descriptor.
     :type descriptor: PluginDescriptor
     :param path: The plugin descriptor path.
     :type path: str
     """
     self.__mutex = RLock()
     self.path = path
     self.descriptor = descriptor
     self.pool = ThreadPool(int(descriptor.main.threads or 1))
     self.impl = None
     self.actions = []
     self.dispatcher = Dispatcher()
     self.whiteboard = Whiteboard()
     self.scheduler = Scheduler(self)
     self.delegate = Delegate()
     self.authenticator = None
     self.consumer = None