diff options
author | Georg Brandl <georg@python.org> | 2009-01-03 20:55:06 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-01-03 20:55:06 (GMT) |
commit | c62ef8b4d9648c36218cb0142a6395a00c11885e (patch) | |
tree | 74d90ea6215a37553bb1cddfc4c4eddf947958e9 /Doc/library/multiprocessing.rst | |
parent | e92818f58c134549c8820073037a1655330bbea1 (diff) | |
download | cpython-c62ef8b4d9648c36218cb0142a6395a00c11885e.zip cpython-c62ef8b4d9648c36218cb0142a6395a00c11885e.tar.gz cpython-c62ef8b4d9648c36218cb0142a6395a00c11885e.tar.bz2 |
Remove trailing whitespace.
Diffstat (limited to 'Doc/library/multiprocessing.rst')
-rw-r--r-- | Doc/library/multiprocessing.rst | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index 1d95999..ec27be0 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -21,9 +21,9 @@ Windows. .. warning:: Some of this package's functionality requires a functioning shared semaphore - implementation on the host operating system. Without one, the - :mod:`multiprocessing.synchronize` module will be disabled, and attempts to - import it will result in an :exc:`ImportError`. See + implementation on the host operating system. Without one, the + :mod:`multiprocessing.synchronize` module will be disabled, and attempts to + import it will result in an :exc:`ImportError`. See :issue:`3770` for additional information. .. note:: @@ -38,7 +38,7 @@ Windows. >>> p = Pool(5) >>> def f(x): ... return x*x - ... + ... >>> p.map(f, [1,2,3]) Process PoolWorker-1: Process PoolWorker-2: @@ -77,11 +77,11 @@ To show the individual process IDs involved, here is an expanded example:: print 'module name:', __name__ print 'parent process:', os.getppid() print 'process id:', os.getpid() - + def f(name): info('function f') print 'hello', name - + if __name__ == '__main__': info('main line') p = Process(target=f, args=('bob',)) @@ -543,7 +543,7 @@ For an example of the usage of queues for interprocess communication see .. method:: put(item[, block[, timeout]]) - Put item into the queue. If the optional argument *block* is ``True`` + Put item into the queue. If the optional argument *block* is ``True`` (the default) and *timeout* is ``None`` (the default), block if necessary until a free slot is available. If *timeout* is a positive number, it blocks at most *timeout* seconds and raises the :exc:`Queue.Full` exception if no @@ -858,7 +858,7 @@ object -- see :ref:`multiprocessing-managers`. acceptable. If *block* is ``True`` and *timeout* is not ``None`` then it specifies a timeout in seconds. If *block* is ``False`` then *timeout* is ignored. - + Note that on OS/X ``sem_timedwait`` is unsupported, so timeout arguments for these will be ignored. @@ -1135,22 +1135,22 @@ their parent process exits. The manager classes are defined in the server process which is using the given address and authentication key. .. method:: get_server() - + Returns a :class:`Server` object which represents the actual server under - the control of the Manager. The :class:`Server` object supports the + the control of the Manager. The :class:`Server` object supports the :meth:`serve_forever` method: - + >>> from multiprocessing.managers import BaseManager >>> m = BaseManager(address=('', 50000), authkey='abc')) >>> server = m.get_server() >>> s.serve_forever() - + :class:`Server` additionally have an :attr:`address` attribute. .. method:: connect() - + Connect a local manager object to a remote manager process: - + >>> from multiprocessing.managers import BaseManager >>> m = BaseManager(address='127.0.0.1', authkey='abc)) >>> m.connect() @@ -1360,7 +1360,7 @@ Another client can also use it:: >>> queue.get() 'hello' -Local processes can also access that queue, using the code from above on the +Local processes can also access that queue, using the code from above on the client to access it remotely:: >>> from multiprocessing import Process, Queue @@ -1371,12 +1371,12 @@ client to access it remotely:: ... super(Worker, self).__init__() ... def run(self): ... self.q.put('local hello') - ... + ... >>> queue = Queue() >>> w = Worker(queue) >>> w.start() >>> class QueueManager(BaseManager): pass - ... + ... >>> QueueManager.register('get_queue', callable=lambda: queue) >>> m = QueueManager(address=('', 50000), authkey='abracadabra') >>> s = m.get_server() @@ -2120,7 +2120,7 @@ Some simple benchmarks comparing :mod:`multiprocessing` with :mod:`threading`: .. literalinclude:: ../includes/mp_benchmarks.py An example/demo of how to use the :class:`managers.SyncManager`, :class:`Process` -and others to build a system which can distribute processes and work via a +and others to build a system which can distribute processes and work via a distributed queue to a "cluster" of machines on a network, accessible via SSH. You will need to have private key authentication for all hosts configured for this to work. |