socketComm
index


 
Communicate via TCP sockets.
 
This module defines a Comm object allowing communications between
slave and master processes. Currently, the slaves cannot directly
communicate.
 
This module implements barrier waits, collection of data from slaves and
sending messages to all slaves.
 
Barrier is robust with respect to machine and processes crashes.

 
Classes
       
builtins.object
Comm
Connection

 
class Comm(builtins.object)
    Comm(numProcs, procNum, host, port=9021, timeout=138240, startupTimeout=50, allowStartupFailures=1, startupDelay=None)
 

 
  Methods defined here:
__init__(s, numProcs, procNum, host, port=9021, timeout=138240, startupTimeout=50, allowStartupFailures=1, startupDelay=None)
conns gets updated to reflect processes which have died.
conns0 does not get updated.
 
if allowStartupFailures is set, this is passed to startServer. If
any failures occur on startup, the processes are renumbered, and
numProcs is appropriately reset.
 
If specified, the startupDelay argument specifies a time (in seconds)
to wait before connecting to the server. For the server (procNum 0),
this has no effect.
barrier(s, timeout=-1)
wait for all slaves. On master, return a list of connections which
reached the barrier. If a connection is found to be dead (process or
machine crashed), it is not included in the returned connections.
collect(s, msg)
send message to procNum 0- returned in sorted fashion
distribute(s, msg)
send message from procNum 0 to all others. Returns this message
info(s, procNum)
multiProc(s)
Called at the end of a single-threaded region begun with singleProc().
This version calls a full barrier()
multiProcNoBarrier(s)
Called at the end of a single-threaded region begun with singleProc().
This version does not call barrier().
procs(s)
Return the a sorted list of the current proc numbers. Only to be
called by proc 0. As it is only consumed by proc 0, 0 is not included
in the returned list.
readDataFrom(s, proc)
read python data from the specified process. The return value is
a Python object. If the specified process does not exist, return
None.
singleProc(s)
Used to perform operation by only a single process. Returns True
for process 0, and False for all others
writeDataTo(s, proc, msg)
write python data to the specified process. Can write any
pickle-able object.

Data descriptors defined here:
__dict__

 
dictionary for instance variables (if defined)
__weakref__

 
list of weak references to the object (if defined)

 
class Connection(builtins.object)
    Connection(sock)
 

 
  Methods defined here:
__init__(s, sock)
Initialize self.  See help(type(self)) for accurate signature.
closed(s)
readData(s)
readln(s)
does not return the trailing newline character.
writeData(s, msg)
msg can be any picklable Python object
writeln(s, str)

Data descriptors defined here:
__dict__

 
dictionary for instance variables (if defined)
__weakref__

 
list of weak references to the object (if defined)

 
Functions
       
startClient(host, port, procNum, startupTimeout, timeout)
connect to port on host
startServer(numConnect, port, startupTimeout, timeout, allowStartupFailures=0)
start server and wait for numConnect connections.
Return dictionary of connections whose keys correspond to process numbers.
 
if allowIncomplete is set, reaching startupTimeout does not throw an
exception: just that process is skipped.
writeDebug(msg)

 
Data
        retryInterval = 1