ppft module documentation¶
auto module¶
ppft auto: an auto-discovery service
- class Discover(base, isclient=False)¶
Bases:
object
Auto-discovery service class
- __firstlineno__ = 46¶
- __static_attributes__ = ('base', 'broadcast_addr', 'bsocket', 'hosts', 'interface_addr', 'isclient', 'socket')¶
- broadcast()¶
Sends a broadcast
- listen()¶
Listens for broadcasts from other clients/servers
- run(interface_addr, broadcast_addr)¶
Starts auto-discovery
common module¶
ppft common: a set of common utilities
- b_(string)¶
- get_class_hierarchy(clazz)¶
- is_not_imported(arg, modules)¶
- class portnumber(min=0, max=65536)¶
Bases:
object
port selector
- Usage:
>>> pick = portnumber(min=1024,max=65535) >>> print( pick() )
select a port number from a given range.
The first call will return a random number from the available range, and each subsequent call will return the next number in the range.
- Inputs:
min – minimum port number [default = 0] max – maximum port number [default = 65536]
- __call__()¶
Call self as a function.
- __firstlineno__ = 98¶
- __static_attributes__ = ('current', 'first', 'max', 'min')¶
- randomport(min=1024, max=65536)¶
select a random port number
- Inputs:
min – minimum port number [default = 1024] max – maximum port number [default = 65536]
- start_thread(name, target, args=(), kwargs={}, daemon=True)¶
Starts a thread
- str_(byte)¶
server module¶
(Remote) ppft servers can be created with ppserver
(or with
python -m ppft.server
), and then jobs can be distributed to remote
workers. See --help
for more details on how to configure a server.
transport module¶
ppft transport: parallel python transport
- class CPipeTransport(r, w)¶
Bases:
PipeTransport
,CTransport
- __firstlineno__ = 263¶
- __static_attributes__ = ()¶
- class CSocketTransport(socket1, socket_timeout)¶
Bases:
SocketTransport
,CTransport
- __firstlineno__ = 267¶
- __static_attributes__ = ()¶
- class CTransport¶
Bases:
Transport
Cached transport
- __firstlineno__ = 80¶
- __static_attributes__ = ()¶
- creceive(preprocess=None)¶
- csend(msg)¶
- hash(msg)¶
- rcache = {}¶
- class PipeTransport(r, w)¶
Bases:
Transport
- __firstlineno__ = 118¶
- __static_attributes__ = ('exiting', 'has_rb', 'has_wb', 'r', 'rb', 'scache', 'w', 'wb')¶
- close()¶
- receive(preprocess=None)¶
- send(msg)¶
- class SocketTransport(socket1, socket_timeout)¶
Bases:
Transport
- __firstlineno__ = 197¶
- __static_attributes__ = ('scache', 'socket')¶
- _connect(host, port)¶
- close()¶
- receive(preprocess=None)¶
- send(data)¶
- class Transport¶
Bases:
object
- __firstlineno__ = 46¶
- __static_attributes__ = ()¶
- _connect(host, port)¶
- authenticate(secret)¶
- close()¶
- receive(preprocess=None)¶
- send(msg)¶
- md5_new(string=b'', *, usedforsecurity=True)¶
Returns a md5 hash object; optionally initialized with a string
- sha_new(string=b'', *, usedforsecurity=True)¶
Returns a sha1 hash object; optionally initialized with a string
worker module¶
ppft worker: a worker to communicate with ppserver
- class _WorkerProcess¶
Bases:
object
- __firstlineno__ = 61¶
- __static_attributes__ = ('e', 'hashmap', 'pickle_proto', 'sout', 't')¶
- run()¶
- ioStringIO¶
alias of
StringIO
- preprocess(msg)¶