| |
- Pyro.core.ObjBase
-
- RemoteObject
- NameServer
- Watcher
- threading.Thread(threading._Verbose)
-
- MyThread
class NameServer |
|
A NameServer object is a proxy for the name server running
on a remote host. |
|
Methods defined here:
- __init__(self, ns_host='rocky.olin.edu')
- Locates the name server on the given host.
- clear(self, prefix='', group=None)
- Unregister all objects in the given group that start
with the given prefix.
- create_group(self, name)
- Creates a group with the given name.
- delete_group(self, name)
- Deletes a group with the given name.
- get_proxy(self, name)
- Looks up a remote object by name and creates a proxy for it.
- get_remote_object_list(self, prefix='', group=None)
- Returns a list of the remote objects in the given group
that start with the given prefix.
- query(self, name, group=None)
- Checks whether the given name is registered in the given group.
Returns 1 if the name is a remote object, 0 if it is a group,
and -1 if it doesn't exist.
|
class RemoteObject(Pyro.core.ObjBase) |
|
Extends Pyro.core.ObjBase and provides a higher level of abstraction.
Objects that want to be available remotely should inherit
from this class, and either (1) don't override __init__ or
(2) call RemoteObject.__init__ explicitly |
|
Methods defined here:
- __init__(self, name=None, ns=None)
- Creates a new RemoteObject with the given name and
registers with the given name server. If name is omitted,
one is generated based on the object id. If ns is omitted,
it uses the default name server.
- cleanup(self)
- Removes this object from the name server.
- connect(self, ns, name)
- Connects to the given name server with the given name.
- join(self)
- Waits for the threadLoop to complete.
- requestLoop(self)
- Runs the request loop until an exception occurs.
- stopLoop(self)
- If stoppableLoop is running, stops it.
- stoppableLoop(self)
- Run handleRequests until another thread clears self.running.
- threadLoop(self)
- Runs the request loop in a separate thread.
Methods inherited from Pyro.core.ObjBase:
- GUID(self)
- Pyro_dyncall(self, method, flags, args)
- delegateTo(self, delegate)
- getAttrProxy(self)
- getDaemon(self)
- getLocalStorage(self)
- getProxy(self)
- remote_retrieve_code(self, name)
- # remote code retrieve support (client retrieves from server):
- remote_supply_code(self, name, module, sourceaddr)
- # remote code downloading support (server downloads from client):
- setCodeValidator(self, v)
- setGUID(self, guid)
- setPyroDaemon(self, daemon)
|
class Watcher |
|
The Watcher class solves two problems with multithreaded
programs in Python, (1) a signal might be delivered
to any thread (which is just a malfeature) and (2) if
the thread that gets the signal is waiting, the signal
is ignored (which is a bug).
The watcher is a concurrent process (not thread) that
waits for a signal and then kills the process that contains the
active threads. See Appendix A of The Little Book of Semaphores.
I have only tested this on Linux. I would expect it to
work on OS X and not work on Windows. |
|
Methods defined here:
- __init__(self, callback=None)
- Creates a child thread, which returns. The parent
thread waits for a KeyboardInterrupt and then kills
the child thread.
- kill(self)
- Kills the child process.
- watch(self, callback=None)
- Waits for a KeyboardInterrupt and then kills the child process.
| |