Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Properties
mp_newtype.MyManager Class Reference
Inheritance diagram for mp_newtype.MyManager:
Inheritance graph
[legend]
Collaboration diagram for mp_newtype.MyManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __reduce__
def get_server
def connect
def start
def join
def __enter__
def __exit__
def register

Public Attributes

 shutdown
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Properties

 address = property(lambda self: self._address)

Detailed Description

Definition at line 44 of file mp_newtype.py.


Member Function Documentation

Definition at line 601 of file managers.py.

00601 
00602     def __enter__(self):
00603         return self

def multiprocessing.managers.BaseManager.__exit__ (   self,
  exc_type,
  exc_val,
  exc_tb 
) [inherited]

Definition at line 604 of file managers.py.

00604 
00605     def __exit__(self, exc_type, exc_val, exc_tb):
00606         self.shutdown()

Here is the caller graph for this function:

Definition at line 486 of file managers.py.

00486 
00487     def __reduce__(self):
00488         return type(self).from_address, \
00489                (self._address, self._authkey, self._serializer)

Connect manager object to the server process

Definition at line 498 of file managers.py.

00498 
00499     def connect(self):
00500         '''
00501         Connect manager object to the server process
00502         '''
00503         Listener, Client = listener_client[self._serializer]
00504         conn = Client(self._address, authkey=self._authkey)
00505         dispatch(conn, None, 'dummy')
00506         self._state.value = State.STARTED

Here is the call graph for this function:

Here is the caller graph for this function:

Return server object with serve_forever() method and address attribute

Definition at line 490 of file managers.py.

00490 
00491     def get_server(self):
00492         '''
00493         Return server object with serve_forever() method and address attribute
00494         '''
00495         assert self._state.value == State.INITIAL
00496         return Server(self._registry, self._address,
00497                       self._authkey, self._serializer)

def multiprocessing.managers.BaseManager.join (   self,
  timeout = None 
) [inherited]
Join the manager process (if it has been spawned)

Definition at line 575 of file managers.py.

00575 
00576     def join(self, timeout=None):
00577         '''
00578         Join the manager process (if it has been spawned)
00579         '''
00580         self._process.join(timeout)

Here is the caller graph for this function:

def multiprocessing.managers.BaseManager.register (   cls,
  typeid,
  callable = None,
  proxytype = None,
  exposed = None,
  method_to_typeid = None,
  create_method = True 
) [inherited]
Register a typeid with the manager type

Definition at line 643 of file managers.py.

00643 
00644                  method_to_typeid=None, create_method=True):
00645         '''
00646         Register a typeid with the manager type
00647         '''
00648         if '_registry' not in cls.__dict__:
00649             cls._registry = cls._registry.copy()
00650 
00651         if proxytype is None:
00652             proxytype = AutoProxy
00653 
00654         exposed = exposed or getattr(proxytype, '_exposed_', None)
00655 
00656         method_to_typeid = method_to_typeid or \
00657                            getattr(proxytype, '_method_to_typeid_', None)
00658 
00659         if method_to_typeid:
00660             for key, value in list(method_to_typeid.items()):
00661                 assert type(key) is str, '%r is not a string' % key
00662                 assert type(value) is str, '%r is not a string' % value
00663 
00664         cls._registry[typeid] = (
00665             callable, exposed, method_to_typeid, proxytype
00666             )
00667 
00668         if create_method:
00669             def temp(self, *args, **kwds):
00670                 util.debug('requesting creation of a shared %r object', typeid)
00671                 token, exp = self._create(typeid, *args, **kwds)
00672                 proxy = proxytype(
00673                     token, self._serializer, manager=self,
00674                     authkey=self._authkey, exposed=exp
00675                     )
00676                 conn = self._Client(token.address, authkey=self._authkey)
00677                 dispatch(conn, None, 'decref', (token.id,))
00678                 return proxy
00679             temp.__name__ = typeid
00680             setattr(cls, typeid, temp)
00681 
00682 #
00683 # Subclass of set which get cleared after a fork
00684 #

Here is the call graph for this function:

def multiprocessing.managers.BaseManager.start (   self,
  initializer = None,
  initargs = () 
) [inherited]
Spawn a server process for this manager object

Definition at line 507 of file managers.py.

00507 
00508     def start(self, initializer=None, initargs=()):
00509         '''
00510         Spawn a server process for this manager object
00511         '''
00512         assert self._state.value == State.INITIAL
00513 
00514         if initializer is not None and not hasattr(initializer, '__call__'):
00515             raise TypeError('initializer must be a callable')
00516 
00517         # pipe over which we will retrieve address of server
00518         reader, writer = connection.Pipe(duplex=False)
00519 
00520         # spawn process which runs a server
00521         self._process = Process(
00522             target=type(self)._run_server,
00523             args=(self._registry, self._address, self._authkey,
00524                   self._serializer, writer, initializer, initargs),
00525             )
00526         ident = ':'.join(str(i) for i in self._process._identity)
00527         self._process.name = type(self).__name__  + '-' + ident
00528         self._process.start()
00529 
00530         # get address of server
00531         writer.close()
00532         self._address = reader.recv()
00533         reader.close()
00534 
00535         # register a finalizer
00536         self._state.value = State.STARTED
00537         self.shutdown = util.Finalize(
00538             self, type(self)._finalize_manager,
00539             args=(self._process, self._address, self._authkey,
00540                   self._state, self._Client),
00541             exitpriority=0
00542             )

Here is the caller graph for this function:


Member Data Documentation

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 536 of file managers.py.


Property Documentation

multiprocessing.managers.BaseManager.address = property(lambda self: self._address) [static, inherited]

Definition at line 639 of file managers.py.


The documentation for this class was generated from the following file: