コード例 #1
0
ファイル: truncatedata.py プロジェクト: naviga-tor/navigator
 def __init__(self):
     try:
         cpus = cpu_count()
     except NotImplementedError:
         cpus = 1
     self._taskqueue = Queue(maxsize=(2 * cpus))
     Pool.__init__(self)
コード例 #2
0
	def __init__(self, processes=None, initializer=None, initargs=(), process=None):
		"""
		@param process: Process subclass to use
		"""
		if process is not None:
			self.Process = process
		Pool.__init__(self, processes, initializer, initargs)
コード例 #3
0
ファイル: truncatedata.py プロジェクト: naviga-tor/navigator
 def __init__(self):
     try:
         cpus = cpu_count()
     except NotImplementedError:
         cpus = 1
     self._taskqueue = Queue(maxsize=(2 * cpus))
     Pool.__init__(self)
コード例 #4
0
ファイル: __init__.py プロジェクト: stjordanis/smp
 def __init__(self,
              processes=None,
              initializer=None,
              initargs=(),
              maxtasksperchild=None):
     if max_top_workers:
         processes = int(max_top_workers)
     Pool.__init__(self, processes, initializer, initargs, maxtasksperchild)
コード例 #5
0
    def __init__(self,
                 ncpu,
                 initializer=None,
                 initargs=(),
                 maxtasksperchild=None,
                 limit=True):
        """
        INPUTS
        ------
        ncpu: int (default 0, i.e, built-in map behavior)
            number of cpu to use for the mapping.
            0 is equivalent to calling the built-in map function
            <0 is equivalent to requesting all cpus

        initializer: callable
            if set, each worker process will call initializer(*initargs) when
            it starts.

        initargs: tuple
            arguments to use with the initializer

        maxtasksperchild: int
            number of tasks a worker process can complete before it will exit
            and be replaced with a fresh worker process, to enable unused
            resources to be freed. The default maxtasksperchild is None, which
            means worker processes will live as long as the pool.

        limit: bool (default True)
            if ncpu is greater than the number of available cpus, setting this
            keyword will limit the request to the maximum available

            Note: sometimes the os load controller does awesome and some speed-up
            could be obtained when requesting more cpus than available
        """
        _n = _mp.cpu_count()
        if (ncpu <= 0):  # use all available cpus
            self._n = _n
        elif (ncpu > _n) & (limit is True):
            self._n = _n
        else:
            self._n = ncpu

        new_initializer = Partial(_initializer_wrapper, initializer)
        _Pool.__init__(self,
                       processes=self._n,
                       initializer=new_initializer,
                       initargs=initargs,
                       maxtasksperchild=maxtasksperchild)
コード例 #6
0
  def __init__(self, *args, **kwargs):
    handler = None
    if logging.getLogger().handlers:
      # Use an existing lo handler if already setup.
      handler = logging.getLogger().handlers[0]
    else:
      # Otherwise use some good defaults.
      handler = logging.StreamHandler(sys.stderr)
      handler.setLevel(logging.INFO)
      handler.setFormat(
        logging.Formatter(
        '%(created)f %(filename)s:%(lineno)s [%(funcName)s] %(message)s'))

    multiprocessing.get_logger().addHandler(handler)

    kwargs['initializer'] = lambda: signal.signal(signal.SIGINT,
      signal.SIG_IGN)
    NativePool.__init__(self, *args, **kwargs)

    self.results = []
    self.prev_message = None
コード例 #7
0
    def __init__(self, *args, **kwargs):
        handler = None
        if logging.getLogger().handlers:
            # Use an existing lo handler if already setup.
            handler = logging.getLogger().handlers[0]
        else:
            # Otherwise use some good defaults.
            handler = logging.StreamHandler(sys.stderr)
            handler.setLevel(logging.INFO)
            handler.setFormat(
                logging.Formatter(
                    '%(created)f %(filename)s:%(lineno)s [%(funcName)s] %(message)s'
                ))

        multiprocessing.get_logger().addHandler(handler)

        kwargs['initializer'] = lambda: signal.signal(signal.SIGINT, signal.
                                                      SIG_IGN)
        NativePool.__init__(self, *args, **kwargs)

        self.results = []
        self.prev_message = None
コード例 #8
0
 def __init__(self, *args, **kwds):
     Pool.__init__(self, *args, **kwds)
     self.results = []
     self.int_results = []
コード例 #9
0
ファイル: dakmultiprocessing.py プロジェクト: abhi11/dak
 def __init__(self, *args, **kwds):
     Pool.__init__(self, *args, **kwds)
     self.results = []
     self.int_results = []
コード例 #10
0
ファイル: multiproc.py プロジェクト: SIRIUS-GOP/sms_service
    def __init__(self, *args, **kwargs):
        self.Process = CAProcess

        Pool.__init__(self, *args, **kwargs)
コード例 #11
0
 def __init__(self, processes):
     Pool.__init__(self, processes, ignoreSigInt)
コード例 #12
0
 def __init__(self, process_num):
     Pool.__init__(self, process_num)
     self.process_num = process_num
コード例 #13
0
ファイル: yarcutils.py プロジェクト: anukat2015/gm-sparql
 def __init__( self, processes ):
     Pool.__init__( self, processes, ignoreSigInt )
コード例 #14
0
 def __init__(self, processes=None):
     """
         MyPoolwithPipe的构造函数
     :param processes: 最大进程数
     """
     BasePool.__init__(self, processes)
コード例 #15
0
ファイル: pool.py プロジェクト: beatific/topology
 def __init__(self, processes=None, initializer=None, initargs=()):
     Pool.__init__(self, processes, initializer, initargs)
     self._taskqueue.maxsize = self._processes
     self._inqueue.maxsize = self._processes
     self._outqueue.maxsize = self._processes
コード例 #16
0
ファイル: pool.py プロジェクト: beatific/topology
 def __init__(self, processes=None, initializer=None, initargs=()):
     Pool.__init__(self, processes, initializer, initargs)
     self._taskqueue.maxsize = self._processes
     self._inqueue.maxsize = self._processes
     self._outqueue.maxsize = self._processes
コード例 #17
0
ファイル: multiproc.py プロジェクト: RobbieClarken/pyepics
    def __init__(self, *args, **kwargs):
        self.Process = CAProcess

        Pool.__init__(self, *args, **kwargs)
コード例 #18
0
ファイル: __init__.py プロジェクト: stjordanis/smp
 def __init__(self, processes=None, initializer=None, initargs=()):
     if max_top_workers:
         processes = int(max_top_workers)
     Pool.__init__(self, processes, initializer, initargs)