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
579 When :mod:`multiprocessing` is initialized the main process is assigned a
586 See :ref:`multiprocessing-auth-keys`.
594 once using :func:`multiprocessing.connection.wait`. Otherwise
645 >>> import multiprocessing, time, signal
646 >>> p = multiprocessing.Process(target=time.sleep, args=(1000,))
661 The base class of all :mod:`multiprocessing` exceptions.
702 :ref:`multiprocessing-managers`.
706 :mod:`multiprocessing` uses the usual :exc:`queue.Empty` and
708 the :mod:`multiprocessing` namespace so you need to import them from
718 :ref:`manager <multiprocessing-managers>`.
741 <multiprocessing.Queue.cancel_join_thread>`), then that process will
750 :ref:`multiprocessing-programming`.
753 :ref:`multiprocessing-examples`.
759 :class:`~multiprocessing.connection.Connection` objects representing the
783 multithreading/multiprocessing semantics, this number is not reliable.
791 multithreading/multiprocessing semantics, this is not reliable.
796 multithreading/multiprocessing semantics, this is not reliable.
835 :class:`multiprocessing.Queue` has a few additional methods not found in
975 Add support for when a program which uses :mod:`multiprocessing` has been
982 from multiprocessing import Process, freeze_support
1012 :mod:`multiprocessing` module.
1062 :mod:`multiprocessing` contains no analogues of
1071 .. currentmodule:: multiprocessing.connection
1077 :func:`Pipe <multiprocessing.Pipe>` -- see also
1078 :ref:`multiprocessing-listeners-clients`.
1116 using :func:`multiprocessing.connection.wait`.
1173 >>> from multiprocessing import Pipe
1200 :ref:`multiprocessing-auth-keys`.
1212 .. currentmodule:: multiprocessing
1219 object -- see :ref:`multiprocessing-managers`.
1244 object from :mod:`multiprocessing`.
1261 :class:`multiprocessing.Lock` as it applies to either processes or threads,
1265 instance of ``multiprocessing.synchronize.Lock`` initialized with a
1315 instance of ``multiprocessing.synchronize.RLock`` initialized with a
1393 :mod:`multiprocessing.synchronize` module will be disabled, and attempts to
1460 The :mod:`multiprocessing.sharedctypes` module
1463 .. module:: multiprocessing.sharedctypes
1466 The :mod:`multiprocessing.sharedctypes` module provides functions for allocating
1517 :class:`~multiprocessing.Lock` or :class:`~multiprocessing.RLock` object
1532 synchronize access to the value. If *lock* is a :class:`~multiprocessing.Lock` or
1533 :class:`~multiprocessing.RLock` object then that will be used to synchronize access to the
1549 :class:`multiprocessing.RLock` object is created automatically.
1579 from multiprocessing import Process, Lock
1580 from multiprocessing.sharedctypes import Value, Array
1635 .. function:: multiprocessing.Manager()
1637 Returns a started :class:`~multiprocessing.managers.SyncManager` object which
1642 .. module:: multiprocessing.managers
1647 :mod:`multiprocessing.managers` module:
1675 >>> from multiprocessing.managers import BaseManager
1686 >>> from multiprocessing.managers import BaseManager
1754 :func:`multiprocessing.Manager`.
1756 Its methods create and return :ref:`multiprocessing-proxy_objects` for a
1846 >>> manager = multiprocessing.Manager()
1862 from multiprocessing.managers import BaseManager
1891 >>> from multiprocessing.managers import BaseManager
1902 >>> from multiprocessing.managers import BaseManager
1912 >>> from multiprocessing.managers import BaseManager
1924 >>> from multiprocessing import Process, Queue
1925 >>> from multiprocessing.managers import BaseManager
1958 >>> from multiprocessing import Manager
1976 :ref:`multiprocessing-proxy_objects`. This permits nesting of these managed
1977 lists, dicts, and other :ref:`multiprocessing-proxy_objects`:
2023 :ref:`multiprocessing-proxy_objects` for most use cases but also
2028 The proxy types in :mod:`multiprocessing` do nothing to support comparisons
2110 .. module:: multiprocessing.pool
2135 function :func:`multiprocessing.Pool` or the :meth:`Pool` method
2143 :class:`multiprocessing.pool` objects have internal resources that need to be
2178 :class:`~multiprocessing.pool.AsyncResult` object.
2209 :class:`~multiprocessing.pool.AsyncResult` object.
2234 ``next(timeout)`` will raise :exc:`multiprocessing.TimeoutError` if the
2292 :exc:`multiprocessing.TimeoutError` is raised. If the remote call raised
2314 from multiprocessing import Pool
2333 print(result.get(timeout=1)) # raises multiprocessing.TimeoutError
2341 .. module:: multiprocessing.connection
2346 :func:`~multiprocessing.Pipe`.
2348 However, the :mod:`multiprocessing.connection` module allows some extra
2362 :exc:`~multiprocessing.AuthenticationError` is raised.
2370 :exc:`~multiprocessing.AuthenticationError` is raised.
2379 *address*. (See :ref:`multiprocessing-address-formats`)
2384 :exc:`~multiprocessing.AuthenticationError` is raised if authentication fails.
2385 See :ref:`multiprocessing-auth-keys`.
2408 :ref:`multiprocessing-address-formats`. Note that if *family* is
2419 :exc:`~multiprocessing.AuthenticationError` is raised if authentication fails.
2420 See :ref:`multiprocessing-auth-keys`.
2427 :exc:`~multiprocessing.AuthenticationError` is raised.
2462 * a readable :class:`~multiprocessing.connection.Connection` object;
2464 * the :attr:`~multiprocessing.Process.sentinel` attribute of a
2465 :class:`~multiprocessing.Process` object.
2492 from multiprocessing.connection import Listener
2510 from multiprocessing.connection import Client
2524 The following code uses :func:`~multiprocessing.connection.wait` to
2528 from multiprocessing import Process, Pipe, current_process
2529 from multiprocessing.connection import wait
2599 :class:`~multiprocessing.Process`). This value will be automatically inherited by
2600 any :class:`~multiprocessing.Process` object that the current process creates.
2615 .. currentmodule:: multiprocessing
2618 Returns the logger used by :mod:`multiprocessing`. If necessary, a new one
2629 .. currentmodule:: multiprocessing
2639 >>> import multiprocessing, logging
2640 >>> logger = multiprocessing.log_to_stderr()
2644 >>> m = multiprocessing.Manager()
2655 The :mod:`multiprocessing.dummy` module
2658 .. module:: multiprocessing.dummy
2661 :mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` but is
2671 :mod:`multiprocessing`.
2703 :func:`~multiprocessing.active_children` is called) all completed processes
2705 process's :meth:`Process.is_alive <multiprocessing.Process.is_alive>` will
2712 from :mod:`multiprocessing` need to be picklable so that child
2721 Using the :meth:`Process.terminate <multiprocessing.Process.terminate>`
2728 :meth:`Process.terminate <multiprocessing.Process.terminate>` on processes
2736 :meth:`Queue.cancel_join_thread <multiprocessing.Queue.cancel_join_thread>`
2747 from multiprocessing import Process, Queue
2778 from multiprocessing import Process, Lock
2790 from multiprocessing import Process, Lock
2802 :mod:`multiprocessing` originally unconditionally called::
2806 in the :meth:`multiprocessing.Process._bootstrap` method --- this resulted
2842 Also, if you subclass :class:`~multiprocessing.Process` then make sure that
2844 <multiprocessing.Process.start>` method is called.
2851 <multiprocessing.Process.start>` was called.
2866 from multiprocessing import Process
2877 from multiprocessing import Process, freeze_support, set_start_method
2909 Using :class:`~multiprocessing.pool.Pool`: