[Python-checkins] r72106 - in python/branches/release30-maint: Doc/library/multiprocessing.rst

r.david.murray python-checkins at python.org
Wed Apr 29 18:44:29 CEST 2009


Author: r.david.murray
Date: Wed Apr 29 18:44:28 2009
New Revision: 72106

Log:
Roll back mistaken checkin of conflicted multiprocessing.rst file.
Merge needs to wait until previous updates to file are merged.

Rolled back revisions 72062 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k


Modified:
   python/branches/release30-maint/   (props changed)
   python/branches/release30-maint/Doc/library/multiprocessing.rst

Modified: python/branches/release30-maint/Doc/library/multiprocessing.rst
==============================================================================
--- python/branches/release30-maint/Doc/library/multiprocessing.rst	(original)
+++ python/branches/release30-maint/Doc/library/multiprocessing.rst	Wed Apr 29 18:44:28 2009
@@ -40,18 +40,12 @@
         >>> p.map(f, [1,2,3])
         Process PoolWorker-1:
         Process PoolWorker-2:
-        Process PoolWorker-3:
-        Traceback (most recent call last):
         Traceback (most recent call last):
         Traceback (most recent call last):
         AttributeError: 'module' object has no attribute 'f'
         AttributeError: 'module' object has no attribute 'f'
         AttributeError: 'module' object has no attribute 'f'
 
-    (If you try this it will actually output three full tracebacks
-    interleaved in a semi-random fashion, and then you may have to
-    stop the master process somehow.)
-
 
 The :class:`Process` class
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -422,9 +416,7 @@
    :attr:`exit_code` methods should only be called by the process that created
    the process object.
 
-   Example usage of some of the methods of :class:`Process`:
-
-   .. doctest::
+   Example usage of some of the methods of :class:`Process`::
 
        >>> import multiprocessing, time, signal
        >>> p = multiprocessing.Process(target=time.sleep, args=(1000,))
@@ -434,7 +426,6 @@
        >>> print(p, p.is_alive())
        <Process(Process-1, started)> True
        >>> p.terminate()
-       >>> time.sleep(0.1)
        >>> print(p, p.is_alive())
        <Process(Process-1, stopped[SIGTERM])> False
        >>> p.exitcode == -signal.SIGTERM
@@ -676,7 +667,7 @@
           freeze_support()
           Process(target=f).start()
 
-   If the ``freeze_support()`` line is omitted then trying to run the frozen
+   If the ``freeze_support()`` line is missed out then trying to run the frozen
    executable will raise :exc:`RuntimeError`.
 
    If the module is being run normally by the Python interpreter then
@@ -690,7 +681,7 @@
 
       setExecutable(os.path.join(sys.exec_prefix, 'pythonw.exe'))
 
-   before they can create child processes.  (Windows only)
+    before they can create child processes.  (Windows only)
 
 
 .. note::
@@ -770,8 +761,8 @@
 
       *buffer* must be an object satisfying the writable buffer interface.  If
       *offset* is given then the message will be written into the buffer from
-      that position.  Offset must be a non-negative integer less than the
-      length of *buffer* (in bytes).
+      *that position.  Offset must be a non-negative integer less than the
+      *length of *buffer* (in bytes).
 
       If the buffer is too short then a :exc:`BufferTooShort` exception is
       raised and the complete message is available as ``e.args[0]`` where ``e``
@@ -780,8 +771,6 @@
 
 For example:
 
-.. doctest::
-
     >>> from multiprocessing import Pipe
     >>> a, b = Pipe()
     >>> a.send([1, 'hello', None])
@@ -868,9 +857,8 @@
    specifies a timeout in seconds.  If *block* is ``False`` then *timeout* is
    ignored.
 
-.. note::
-   On OS/X ``sem_timedwait`` is unsupported, so timeout arguments for the
-   aforementioned :meth:`acquire` methods will be ignored on OS/X.
+   Note that on OS/X ``sem_timedwait`` is unsupported, so timeout arguments
+   for these will be ignored.
 
 .. note::
 
@@ -1067,7 +1055,7 @@
        lock = Lock()
 
        n = Value('i', 7)
-       x = Value(c_double, 1.0/3.0, lock=False)
+       x = Value(ctypes.c_double, 1.0/3.0, lock=False)
        s = Array('c', 'hello world', lock=lock)
        A = Array(Point, [(1.875,-6.25), (-5.75,2.0), (2.375,9.5)], lock=lock)
 
@@ -1148,21 +1136,21 @@
 
       Returns a :class:`Server` object which represents the actual server under
       the control of the Manager. The :class:`Server` object supports the
-      :meth:`serve_forever` method::
+      :meth:`serve_forever` method:
 
       >>> from multiprocessing.managers import BaseManager
-      >>> manager = BaseManager(address=('', 50000), authkey='abc')
-      >>> server = manager.get_server()
-      >>> server.serve_forever()
+      >>> m = BaseManager(address=('', 50000), authkey='abc'))
+      >>> server = m.get_server()
+      >>> s.serve_forever()
 
-      :class:`Server` additionally has an :attr:`address` attribute.
+      :class:`Server` additionally have an :attr:`address` attribute.
 
    .. method:: connect()
 
-      Connect a local manager object to a remote manager process::
+      Connect a local manager object to a remote manager process:
 
       >>> from multiprocessing.managers import BaseManager
-      >>> m = BaseManager(address=('127.0.0.1', 5000), authkey='abc')
+      >>> m = BaseManager(address='127.0.0.1', authkey='abc'))
       >>> m.connect()
 
    .. method:: shutdown()
@@ -1290,9 +1278,7 @@
 Its representation shows the values of its attributes.
 
 However, when using a proxy for a namespace object, an attribute beginning with
-``'_'`` will be an attribute of the proxy and not an attribute of the referent:
-
-.. doctest::
+``'_'`` will be an attribute of the proxy and not an attribute of the referent::
 
    >>> manager = multiprocessing.Manager()
    >>> Global = manager.Namespace()
@@ -1344,15 +1330,17 @@
    >>> import queue
    >>> queue = queue.Queue()
    >>> class QueueManager(BaseManager): pass
+   ...
    >>> QueueManager.register('get_queue', callable=lambda:queue)
    >>> m = QueueManager(address=('', 50000), authkey='abracadabra')
    >>> s = m.get_server()
-   >>> s.serve_forever()
+   >>> s.serveForever()
 
 One client can access the server as follows::
 
    >>> from multiprocessing.managers import BaseManager
    >>> class QueueManager(BaseManager): pass
+   ...
    >>> QueueManager.register('get_queue')
    >>> m = QueueManager(address=('foo.bar.org', 50000), authkey='abracadabra')
    >>> m.connect()
@@ -1363,10 +1351,10 @@
 
    >>> from multiprocessing.managers import BaseManager
    >>> class QueueManager(BaseManager): pass
-   >>> QueueManager.register('get_queue')
-   >>> m = QueueManager(address=('foo.bar.org', 50000), authkey='abracadabra')
-   >>> m.connect()
-   >>> queue = m.get_queue()
+   ...
+   >>> QueueManager.register('getQueue')
+   >>> m = QueueManager.from_address(address=('foo.bar.org', 50000), authkey='abracadabra')
+   >>> queue = m.getQueue()
    >>> queue.get()
    'hello'
 
@@ -1402,9 +1390,7 @@
 A proxy object has methods which invoke corresponding methods of its referent
 (although not every method of the referent will necessarily be available through
 the proxy).  A proxy can usually be used in most of the same ways that its
-referent can:
-
-.. doctest::
+referent can::
 
    >>> from multiprocessing import Manager
    >>> manager = Manager()
@@ -1412,7 +1398,7 @@
    >>> print(l)
    [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
    >>> print(repr(l))
-   <ListProxy object, typeid 'list' at 0x...>
+   <ListProxy object, typeid 'list' at 0xb799974c>
    >>> l[4]
    16
    >>> l[2:5]
@@ -1425,9 +1411,7 @@
 An important feature of proxy objects is that they are picklable so they can be
 passed between processes.  Note, however, that if a proxy is sent to the
 corresponding manager's process then unpickling it will produce the referent
-itself.  This means, for example, that one shared object can contain a second:
-
-.. doctest::
+itself.  This means, for example, that one shared object can contain a second::
 
    >>> a = manager.list()
    >>> b = manager.list()
@@ -1441,14 +1425,12 @@
 .. note::
 
    The proxy types in :mod:`multiprocessing` do nothing to support comparisons
-   by value.  So, for instance, we have:
-
-   .. doctest::
+   by value.  So, for instance, ::
 
-       >>> manager.list([1,2,3]) == [1,2,3]
-       False
+       manager.list([1,2,3]) == [1,2,3]
 
-   One should just use a copy of the referent instead when making comparisons.
+   will return ``False``.  One should just use a copy of the referent instead
+   when making comparisons.
 
 .. class:: BaseProxy
 
@@ -1480,9 +1462,7 @@
       Note in particular that an exception will be raised if *methodname* has
       not been *exposed*
 
-      An example of the usage of :meth:`_callmethod`:
-
-      .. doctest::
+      An example of the usage of :meth:`_callmethod`::
 
          >>> l = manager.list(range(10))
          >>> l._callmethod('__len__')
@@ -1893,55 +1873,13 @@
     >>> logger.warning('doomed')
     [WARNING/MainProcess] doomed
     >>> m = multiprocessing.Manager()
-<<<<<<< .working
     [INFO/SyncManager-1] child process calling self.run()
     [INFO/SyncManager-1] manager bound to '\\\\.\\pipe\\pyc-2776-0-lj0tfa'
-=======
-    [INFO/SyncManager-...] child process calling self.run()
-    [INFO/SyncManager-...] created temp directory /.../pymp-...
-    [INFO/SyncManager-...] manager serving at '/.../listener-...'
->>>>>>> .merge-right.r72062
     >>> del m
     [INFO/MainProcess] sending shutdown message to manager
-    [INFO/SyncManager-...] manager exiting with exitcode 0
+    [INFO/SyncManager-1] manager exiting with exitcode 0
 
 
-<<<<<<< .working
-=======
-+----------------+----------------+
-| Level          | Numeric value  |
-+================+================+
-| ``SUBWARNING`` | 25             |
-+----------------+----------------+
-| ``SUBDEBUG``   | 5              |
-+----------------+----------------+
-
-For a full table of logging levels, see the :mod:`logging` module.
-
-These additional logging levels are used primarily for certain debug messages
-within the multiprocessing module. Below is the same example as above, except
-with :const:`SUBDEBUG` enabled::
-
-    >>> import multiprocessing, logging
-    >>> logger = multiprocessing.log_to_stderr()
-    >>> logger.setLevel(multiprocessing.SUBDEBUG)
-    >>> logger.warning('doomed')
-    [WARNING/MainProcess] doomed
-    >>> m = multiprocessing.Manager()
-    [INFO/SyncManager-...] child process calling self.run()
-    [INFO/SyncManager-...] created temp directory /.../pymp-...
-    [INFO/SyncManager-...] manager serving at '/.../pymp-djGBXN/listener-...'
-    >>> del m
-    [SUBDEBUG/MainProcess] finalizer calling ...
-    [INFO/MainProcess] sending shutdown message to manager
-    [DEBUG/SyncManager-...] manager received shutdown message
-    [SUBDEBUG/SyncManager-...] calling <Finalize object, callback=unlink, ...
-    [SUBDEBUG/SyncManager-...] finalizer calling <built-in function unlink> ...
-    [SUBDEBUG/SyncManager-...] calling <Finalize object, dead>
-    [SUBDEBUG/SyncManager-...] finalizer calling <function rmtree at 0x5aa730> ...
-    [INFO/SyncManager-...] manager exiting with exitcode 0
-
->>>>>>> .merge-right.r72062
 The :mod:`multiprocessing.dummy` module
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 


More information about the Python-checkins mailing list