Esempio n. 1
0
class RunThreadPool:
    def __init__(self, Psize=10):
        self.executor = ThreadPool(Psize=Psize)

    def run(self):
        job_done = JobDone()
        self.executor.add(job, job_done.set)
        job_done.wait()
Esempio n. 2
0
def scan_taurus_thread_pool(file_, pandas=False):
    global executor
    if executor is None:
        from taurus.core.util.threadpool import ThreadPool
        executor = ThreadPool(Psize=10, daemons=True)
    scan_done = ScanDone()
    executor.add(scan, scan_done.set, file_, pandas)
    scan_done.wait()
Esempio n. 3
0
def get_thread_pool():
    """Returns the global pool of threads for Sardana

    :return: the global pool of threads object
    :rtype: taurus.core.util.ThreadPool"""

    global __thread_pool
    global __thread_pool_lock
    with __thread_pool_lock:
        if __thread_pool is None:
            __thread_pool = ThreadPool(name="SardanaTP", Psize=10)
        return __thread_pool
Esempio n. 4
0
def get_thread_pool():
    """Returns the global pool of threads for Sardana

    :return: the global pool of threads object
    :rtype: taurus.core.util.ThreadPool"""

    global __thread_pool
    global __thread_pool_lock
    with __thread_pool_lock:
        if __thread_pool is None:
            # protect older versions of Taurus (without the worker_cls
            # argument) remove it whenever we bump Taurus dependency
            try:
                __thread_pool = ThreadPool(name="SardanaTP",
                                           Psize=10,
                                           worker_cls=OmniWorker)
            except TypeError:
                import taurus
                taurus.warning("Your Sardana system is affected by bug "
                               "tango-controls/pytango#307. Please use "
                               "Taurus with taurus-org/taurus#1081.")
                __thread_pool = ThreadPool(name="SardanaTP", Psize=10)

        return __thread_pool
Esempio n. 5
0
def run_thread_pool_with_join(Psize):
    executor = ThreadPool(Psize=Psize)
    job_done = JobDone()
    executor.add(job, job_done.set)
    job_done.wait()
    executor.join()
Esempio n. 6
0
 def __init__(self, Psize=10):
     self.executor = ThreadPool(Psize=Psize)