def test_process_pool_threading(self): from libtbx.scheduling import process_pool from libtbx.scheduling import thread_handler import threading creator = process_pool.creator( job_factory = threading.Thread, inq_factory = thread_handler.qfactory, outq_factory = thread_handler.qfactory, autoscaling = process_pool.constant_capacity( capacity = 1 ), lifecycle = process_pool.unlimited, ) self.run_tests( creator = creator )
def test_process_pool_threading(self): from libtbx.scheduling import process_pool from libtbx.scheduling import thread_handler import threading creator = process_pool.creator( job_factory=threading.Thread, inq_factory=thread_handler.qfactory, outq_factory=thread_handler.qfactory, autoscaling=process_pool.constant_capacity(capacity=1), lifecycle=process_pool.unlimited, ) self.run_tests(creator=creator)
def test_process_pool_multiprocessing(self): from libtbx.scheduling import process_pool from libtbx.scheduling import mp_handler creator = process_pool.creator( job_factory = mp_handler.stderr_capturing_process, inq_factory = mp_handler.fifo_qfactory, outq_factory = mp_handler.fifo_qfactory, autoscaling = process_pool.constant_capacity( capacity = 1 ), lifecycle = process_pool.unlimited, ) import sys self.run_tests( creator = creator, perform_crash_test = ( sys.platform != "win32" ), )
def test_process_pool_multiprocessing(self): from libtbx.scheduling import process_pool from libtbx.scheduling import mp_handler creator = process_pool.creator( job_factory=mp_handler.stderr_capturing_process, inq_factory=mp_handler.fifo_qfactory, outq_factory=mp_handler.fifo_qfactory, autoscaling=process_pool.constant_capacity(capacity=1), lifecycle=process_pool.unlimited, ) import sys self.run_tests( creator=creator, perform_crash_test=(sys.platform != "win32"), )
def creator(self, technology, ncpus, params): from libtbx.scheduling import process_pool if ncpus is None: # special for unlimited option raise ConfigurationError("option does not allow unlimited capacity (ncpus=None)") setting = technology.settings( params = params ) return process_pool.creator( job_factory = setting.jfactory, inq_factory = setting.inqfactory, outq_factory = setting.outqfactory, autoscaling = self.autoscaling( ncpus = ncpus ), lifecycle = setting.lifecycle(), waittime = self.waittime, stalltime = self.stalltime, idle_timeout = self.idle_timeout, )
def creator(self, technology, ncpus, params): from libtbx.scheduling import process_pool if ncpus is None: # special for unlimited option raise ConfigurationError, "option does not allow unlimited capacity (ncpus=None)" setting = technology.settings( params = params ) return process_pool.creator( job_factory = setting.jfactory, inq_factory = setting.inqfactory, outq_factory = setting.outqfactory, autoscaling = self.autoscaling( ncpus = ncpus ), lifecycle = setting.lifecycle(), waittime = self.waittime, stalltime = self.stalltime, idle_timeout = self.idle_timeout, )