Python start pool
9 Python code examples are found related to "
start pool".
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: microWebSrv2.py From MicroWebSrv2 with MIT License | 6 votes |
def StartInPool(self, asyncSocketsPool) : if not isinstance(asyncSocketsPool, XAsyncSocketsPool) : raise ValueError('"asyncSocketsPool" must be a XAsyncSocketsPool class.') if self._xasSrv : raise MicroWebSrv2Exception('Server is already running.') try : xBufSlots = XBufferSlots( slotsCount = self._slotsCount, slotsSize = self._slotsSize, keepAlloc = self._keepAlloc ) except : raise MicroWebSrv2Exception('Not enough memory to allocate slots.') try : self._xasSrv = XAsyncTCPServer.Create( asyncSocketsPool = asyncSocketsPool, srvAddr = self._bindAddr, srvBacklog = self._backlog, bufSlots = xBufSlots ) except : raise MicroWebSrv2Exception('Cannot bind server on %s:%s.' % self._bindAddr) self._xasSrv.OnClientAccepted = self._onSrvClientAccepted self._xasSrv.OnClosed = self._onSrvClosed self.Log('Server listening on %s:%s.' % self._bindAddr, MicroWebSrv2.INFO) # ------------------------------------------------------------------------
Example 2
Source File: libvirt_storage.py From avocado-vt with GNU General Public License v2.0 | 5 votes |
def start_pool(self, name): """ Start pool if it is inactive. """ if self.is_pool_active(name): logging.info("Pool '%s' is already active.", name) return True try: self.virsh_instance.pool_start(name, ignore_status=False) except process.CmdError as details: logging.error("Start pool '%s' failed: %s", name, details) return False logging.info("Started pool '%s'", name) return True
Example 3
Source File: reusable.py From teleport with Apache License 2.0 | 5 votes |
def start_pool(self): if not self.started: self.create_pool() for worker in self.workers: with worker.worker_lock: worker.thread.start() self.started = True self.terminated = False if log_enabled(BASIC): log(BASIC, 'worker started for pool <%s>', self) return True return False
Example 4
Source File: manager.py From vdi-broker with Apache License 2.0 | 5 votes |
def start_pool_manager(ctxt, application_id): global _pool_managers if application_id not in _pool_managers: pool_manager = PoolManager(ctxt, application_id) pool_manager.start() _pool_managers[application_id] = pool_manager
Example 5
Source File: xml_api_parser.py From manila with Apache License 2.0 | 5 votes |
def start_storage_pool(self, elm, result): self.elt = {} property = ('name', 'autoSize', 'usedSize', 'diskType', 'pool', 'dataServicePolicies', 'virtualProvisioning') list_property = ('movers',) self._copy_property(elm.attrib, self.elt, property, list_property) result['objects'].append(self.elt)
Example 6
Source File: rabbit.py From OnToology with Apache License 2.0 | 5 votes |
def start_pool(num_of_thread=1): """ :param num_of_thread: :return: """ global logger threads = [] for i in range(num_of_thread): th = threading.Thread(target=single_worker, args=(i,)) th.start() logger.debug("spawn: "+str(i)) threads.append(th) logger.debug("total spawned: "+str(threads)) for th in threads: th.join()
Example 7
Source File: worker_pool.py From tls-canary with Mozilla Public License 2.0 | 5 votes |
def start_pool(worq_url, num_workers=1, **kw): broker = init(worq_url) new_pool = WorkerPool(broker, workers=num_workers) new_pool.start(**kw) return new_pool
Example 8
Source File: QueuedPool.py From RMS with GNU General Public License v3.0 | 5 votes |
def startPool(self, cores=None): """ Start the pool with the given worker function and number of cores. """ if cores is not None: self.cores.set(cores) self.printAndLog('Using {:d} cores'.format(self.cores.value())) # Initialize the pool of workers with the given number of worker cores # Comma in the argument list is a must! self.pool = multiprocessing.Pool(self.cores.value(), self._workerFunc, (self.func, ))
Example 9
Source File: indypool.py From indy-node with Apache License 2.0 | 4 votes |
def startIndyPool(**kwargs): '''Start the indy_pool docker container iff it is not already running. See <indy-sdk>/ci/indy-pool.dockerfile for details. Idempotent. Simply ensures that the indy_pool container is up and running.''' # TODO: Decide if we need a separate docker container for testing and one for # development. The indy_sdk tests setup and teardown "indy_pool" on # ports 9701-9708. Perhaps we need an "indy_dev_pool" on 9709-9716? I'm # not quite sure where all of our dependencies are on port 9701-9708. # If the test harness (mocks) are hardcoding 9701-9708, then an # indy_dev_pool on different ports will not work. print("Starting indy_pool ...") # Check if indy_pool is running if containerIsRunning("indy_pool"): print("... already running") exit(0) else: # If the container already exists and isn't running, force remove it and # readd it. This is brute force, but is sufficient and simple. container = getContainer("indy_pool") if container: container.remove(force=True) # Build and run indy_pool if it is not already running # Build the indy_pool image from the dockerfile in: # /vagrant/indy-sdk/ci/indy-pool.dockerfile # # In shell using docker cli: # cd /vagrant/indy-sdk # sudo docker build -f ci/indy-pool.dockerfile -t indy_pool . # # NOTE: https://jira.hyperledger.org/browse/IS-406 prevents indy_pool from # starting on the `rc` branch. Apply the patch in the Jira issue to # overcome this problem. try: # indy-sdk won't be in /vagrant if the indy-sdk is cloned to a directory outside # the Vagrant project. Regardless of where indy-sdk is cloned, it will be found # in /src/indy-sdk in the Vagrant VM. image = getImage(path="/src/indy-sdk", dockerfile="ci/indy-pool.dockerfile", tag="indy_pool") except TypeError as exc: image = getImage(path="/vagrant/indy-sdk", dockerfile="ci/indy-pool.dockerfile", tag="indy_pool") except: print("Failed to find indy-pool.dockerfile in /vagrant/indy-sdk or /src/indy-sdk") # Run a container using the image # # In shell using docker cli: # sudo docker run -itd -p 9701-9708:9701-9708 indy_pool # # NOTE: {'2222/tcp': 3333} is sufficient. A tuple of (address, port) if you # want to specify the host interface. container = runContainer(image, ports={ '9701/tcp': ('0.0.0.0', 9701), '9702/tcp': ('0.0.0.0', 9702), '9703/tcp': ('0.0.0.0', 9703), '9704/tcp': ('0.0.0.0', 9704), '9705/tcp': ('0.0.0.0', 9705), '9706/tcp': ('0.0.0.0', 9706), '9707/tcp': ('0.0.0.0', 9707), '9708/tcp': ('0.0.0.0', 9708) }, detach=True, name="indy_pool" ) print("...started")