socketComm
index
socketComm.py


  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
       
Comm
Connection

 
class Comm
     Methods defined here:
__init__(s, numProcs, procNum, host, port=9021, timeout=138240, startupTimeout=50, allowStartupFailures=1)

        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.
        
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)

 
class Connection
     Methods defined here:
__init__(s, sock)
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)

 
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