• Home
  • Raw
  • Download

Lines Matching refs:multiprocessing

1 :mod:`multiprocessing` --- Process-based parallelism
4 .. module:: multiprocessing
7 **Source code:** :source:`Lib/multiprocessing/`
14 :mod:`multiprocessing` is a package that supports spawning processes using an
15 API similar to the :mod:`threading` module. The :mod:`multiprocessing` package
19 to this, the :mod:`multiprocessing` module allows the programmer to fully
23 The :mod:`multiprocessing` module also introduces APIs which do not have
25 :class:`~multiprocessing.pool.Pool` object which offers a convenient means of
30 of data parallelism using :class:`~multiprocessing.pool.Pool`, ::
32 from multiprocessing import Pool
49 In :mod:`multiprocessing`, processes are spawned by creating a :class:`Process`
54 from multiprocessing import Process
66 from multiprocessing import Process
86 necessary, see :ref:`multiprocessing-programming`.
95 Depending on the platform, :mod:`multiprocessing` supports three ways
143 :class:`~multiprocessing.shared_memory.SharedMemory` objects) created
157 import multiprocessing as mp
174 object. Context objects have the same API as the multiprocessing
178 import multiprocessing as mp
211 :mod:`multiprocessing` supports two types of communication channel between
219 from multiprocessing import Process, Queue
238 from multiprocessing import Process, Pipe
263 :mod:`multiprocessing` contains equivalents of all the synchronization
267 from multiprocessing import Process, Lock
294 :mod:`multiprocessing` provides a couple of ways of doing so.
301 from multiprocessing import Process, Value, Array
330 :mod:`multiprocessing.sharedctypes` module which supports the creation of
345 from multiprocessing import Process, Manager
379 The :class:`~multiprocessing.pool.Pool` class represents a pool of worker
385 from multiprocessing import Pool, TimeoutError
420 print("We lacked patience and got a multiprocessing.TimeoutError")
433 importable by the children. This is covered in :ref:`multiprocessing-programming`
435 as the :class:`multiprocessing.pool.Pool` examples will not work in the
438 >>> from multiprocessing import Pool
463 The :mod:`multiprocessing` package mostly replicates the API of the
586 When :mod:`multiprocessing` is initialized the main process is assigned a
593 See :ref:`multiprocessing-auth-keys`.
601 once using :func:`multiprocessing.connection.wait`. Otherwise
652 >>> import multiprocessing, time, signal
653 >>> p = multiprocessing.Process(target=time.sleep, args=(1000,))
668 The base class of all :mod:`multiprocessing` exceptions.
709 :ref:`multiprocessing-managers`.
713 :mod:`multiprocessing` uses the usual :exc:`queue.Empty` and
715 the :mod:`multiprocessing` namespace so you need to import them from
725 :ref:`manager <multiprocessing-managers>`.
748 <multiprocessing.Queue.cancel_join_thread>`), then that process will
757 :ref:`multiprocessing-programming`.
760 :ref:`multiprocessing-examples`.
766 :class:`~multiprocessing.connection.Connection` objects representing the
790 multithreading/multiprocessing semantics, this number is not reliable.
798 multithreading/multiprocessing semantics, this is not reliable.
803 multithreading/multiprocessing semantics, this is not reliable.
842 :class:`multiprocessing.Queue` has a few additional methods not found in
983 Add support for when a program which uses :mod:`multiprocessing` has been
990 from multiprocessing import Process, freeze_support
1020 :mod:`multiprocessing` module.
1076 :mod:`multiprocessing` contains no analogues of
1085 .. currentmodule:: multiprocessing.connection
1091 :func:`Pipe <multiprocessing.Pipe>` -- see also
1092 :ref:`multiprocessing-listeners-clients`.
1130 using :func:`multiprocessing.connection.wait`.
1187 >>> from multiprocessing import Pipe
1215 :ref:`multiprocessing-auth-keys`.
1227 .. currentmodule:: multiprocessing
1234 object -- see :ref:`multiprocessing-managers`.
1259 object from :mod:`multiprocessing`.
1276 :class:`multiprocessing.Lock` as it applies to either processes or threads,
1280 instance of ``multiprocessing.synchronize.Lock`` initialized with a
1330 instance of ``multiprocessing.synchronize.RLock`` initialized with a
1408 :mod:`multiprocessing.synchronize` module will be disabled, and attempts to
1475 The :mod:`multiprocessing.sharedctypes` module
1478 .. module:: multiprocessing.sharedctypes
1481 The :mod:`multiprocessing.sharedctypes` module provides functions for allocating
1532 :class:`~multiprocessing.Lock` or :class:`~multiprocessing.RLock` object
1547 synchronize access to the value. If *lock* is a :class:`~multiprocessing.Lock` or
1548 :class:`~multiprocessing.RLock` object then that will be used to synchronize access to the
1564 :class:`multiprocessing.RLock` object is created automatically.
1594 from multiprocessing import Process, Lock
1595 from multiprocessing.sharedctypes import Value, Array
1650 .. function:: multiprocessing.Manager()
1652 Returns a started :class:`~multiprocessing.managers.SyncManager` object which
1657 .. module:: multiprocessing.managers
1662 :mod:`multiprocessing.managers` module:
1690 >>> from multiprocessing.managers import BaseManager
1701 >>> from multiprocessing.managers import BaseManager
1769 :func:`multiprocessing.Manager`.
1771 Its methods create and return :ref:`multiprocessing-proxy_objects` for a
1861 >>> manager = multiprocessing.Manager()
1877 from multiprocessing.managers import BaseManager
1906 >>> from multiprocessing.managers import BaseManager
1917 >>> from multiprocessing.managers import BaseManager
1927 >>> from multiprocessing.managers import BaseManager
1939 >>> from multiprocessing import Process, Queue
1940 >>> from multiprocessing.managers import BaseManager
1973 >>> from multiprocessing import Manager
1991 :ref:`multiprocessing-proxy_objects`. This permits nesting of these managed
1992 lists, dicts, and other :ref:`multiprocessing-proxy_objects`:
2038 :ref:`multiprocessing-proxy_objects` for most use cases but also
2043 The proxy types in :mod:`multiprocessing` do nothing to support comparisons
2125 .. module:: multiprocessing.pool
2150 function :func:`multiprocessing.Pool` or the :meth:`Pool` method
2158 :class:`multiprocessing.pool` objects have internal resources that need to be
2193 :class:`~multiprocessing.pool.AsyncResult` object.
2224 :class:`~multiprocessing.pool.AsyncResult` object.
2249 ``next(timeout)`` will raise :exc:`multiprocessing.TimeoutError` if the
2260 Like :meth:`~multiprocessing.pool.Pool.map` except that the
2308 :exc:`multiprocessing.TimeoutError` is raised. If the remote call raised
2330 from multiprocessing import Pool
2349 print(result.get(timeout=1)) # raises multiprocessing.TimeoutError
2357 .. module:: multiprocessing.connection
2362 :func:`~multiprocessing.Pipe`.
2364 However, the :mod:`multiprocessing.connection` module allows some extra
2378 :exc:`~multiprocessing.AuthenticationError` is raised.
2386 :exc:`~multiprocessing.AuthenticationError` is raised.
2395 *address*. (See :ref:`multiprocessing-address-formats`)
2400 :exc:`~multiprocessing.AuthenticationError` is raised if authentication fails.
2401 See :ref:`multiprocessing-auth-keys`.
2424 :ref:`multiprocessing-address-formats`. Note that if *family* is
2435 :exc:`~multiprocessing.AuthenticationError` is raised if authentication fails.
2436 See :ref:`multiprocessing-auth-keys`.
2443 :exc:`~multiprocessing.AuthenticationError` is raised.
2478 * a readable :class:`~multiprocessing.connection.Connection` object;
2480 * the :attr:`~multiprocessing.Process.sentinel` attribute of a
2481 :class:`~multiprocessing.Process` object.
2508 from multiprocessing.connection import Listener
2526 from multiprocessing.connection import Client
2540 The following code uses :func:`~multiprocessing.connection.wait` to
2544 from multiprocessing import Process, Pipe, current_process
2545 from multiprocessing.connection import wait
2615 :class:`~multiprocessing.Process`). This value will be automatically inherited by
2616 any :class:`~multiprocessing.Process` object that the current process creates.
2631 .. currentmodule:: multiprocessing
2634 Returns the logger used by :mod:`multiprocessing`. If necessary, a new one
2645 .. currentmodule:: multiprocessing
2656 >>> import multiprocessing, logging
2657 >>> logger = multiprocessing.log_to_stderr()
2661 >>> m = multiprocessing.Manager()
2672 The :mod:`multiprocessing.dummy` module
2675 .. module:: multiprocessing.dummy
2678 :mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` but is
2681 .. currentmodule:: multiprocessing.pool
2683 In particular, the ``Pool`` function provided by :mod:`multiprocessing.dummy`
2695 calling :meth:`~multiprocessing.pool.Pool.close` and
2696 :meth:`~multiprocessing.pool.Pool.terminate` manually.
2728 :mod:`multiprocessing`.
2760 :func:`~multiprocessing.active_children` is called) all completed processes
2762 process's :meth:`Process.is_alive <multiprocessing.Process.is_alive>` will
2769 from :mod:`multiprocessing` need to be picklable so that child
2778 Using the :meth:`Process.terminate <multiprocessing.Process.terminate>`
2785 :meth:`Process.terminate <multiprocessing.Process.terminate>` on processes
2793 :meth:`Queue.cancel_join_thread <multiprocessing.Queue.cancel_join_thread>`
2804 from multiprocessing import Process, Queue
2835 from multiprocessing import Process, Lock
2847 from multiprocessing import Process, Lock
2859 :mod:`multiprocessing` originally unconditionally called::
2863 in the :meth:`multiprocessing.Process._bootstrap` method --- this resulted
2899 Also, if you subclass :class:`~multiprocessing.Process` then make sure that
2901 <multiprocessing.Process.start>` method is called.
2908 <multiprocessing.Process.start>` was called.
2923 from multiprocessing import Process
2934 from multiprocessing import Process, freeze_support, set_start_method
2966 Using :class:`~multiprocessing.pool.Pool`: