Package solvcon :: Module rpc :: Class Worker
[hide private]
[frames] | no frames]

Class Worker

source code

object --+
         |
        Worker

The whole worker object will run remotely (means in separated process).

Instance Methods [hide private]
 
__init__(self, muscle, profiler_data=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_eventloop(self)
Event loop.
source code
 
eventloop(self) source code
 
register(self, address, authkey, *args, **kw)
Connect to remote listener and run event lop.
source code
 
run(self, address, authkey, *args, **kw)
Listen to given address and run event loop.
source code
 
chdir(self, dirname) source code
 
remote_setattr(self, name, var)
Remotely set attribute of worker.
source code
 
remote_loadobj(self, name, objfn)
Remotely unpickle a file and set it to self with the specified name.
source code
 
barrier(self)
Send barrier signal for synchronization.
source code
 
accept_peer(self, peern, family, authkey)
Accept connection from specified peer.
source code
 
connect_peer(self, peern, address, authkey)
Make a connection to specified peer (it has to be accepting connection).
source code
 
set_peer(self, src, dst)
Create MPI proxy for a pair of p2p connection.
source code
 
get_port_by_mpi(self, dst, tag) source code
 
terminate(self) source code
 
create_solver(self, bcmap, dirname, blkfn, iblk, nblk, solvertype, svrkw)
Load a block and create a solver object with the given information, and set it to muscle.
source code
 
drop_anchor(self, ankcls, ankkw)
Create an anchor object and append it to the solver muscle.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
  conn
the connection object to master.
  lsnr
the listener object for master.
  muscle
the muscle object.
  pconns
dictionary of connection objects to peers.
  plsnrs
dictionary of listener objects for peers.
  serial
serial number of the worker process.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, muscle, profiler_data=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

register(self, address, authkey, *args, **kw)

source code 

Connect to remote listener and run event lop. In this case, the worker don't have a valid listener since it acts as a client to the dealer.

Parameters:
  • address (str or tuple) - address to connect.
  • authkey (str) - authentication key for connection.

run(self, address, authkey, *args, **kw)

source code 

Listen to given address and run event loop. In this case, the worker has the listener and acts as a server.

Parameters:
  • address (str or tuple) - address to listen.
  • authkey (str) - authentication key for connection.

accept_peer(self, peern, family, authkey)

source code 

Accept connection from specified peer.

Parameters:
  • peern (int) - index of the peer who wants to connect.
  • family (str) - the family of address needed to be guessed.
  • authkey (str) - authentication key for connection.

connect_peer(self, peern, address, authkey)

source code 

Make a connection to specified peer (it has to be accepting connection).

Parameters:
  • peern (int) - index of the peer who wants to connect.
  • address (str or tuple) - the address to connect to.
  • authkey (str) - authentication key for connection.

set_peer(self, src, dst)

source code 

Create MPI proxy for a pair of p2p connection.

Parameters:
  • src (int) - source worker ID.
  • dst (int) - destination worker ID.

create_solver(self, bcmap, dirname, blkfn, iblk, nblk, solvertype, svrkw)

source code 

Load a block and create a solver object with the given information, and set it to muscle.

Parameters:
  • bcmap (dict) - BC mapper.
  • dirname (str) - the directory of saved domain object.
  • blkfn (str) - the relative path for the block to be loaded.
  • iblk (int) - index of the block to be loaded.
  • nblk (int) - number of total blocks (sub-domains).
  • solvertype (type) - the type of solver to be created.
  • svrkw (dict) - keywords passed to the constructor of solver.
Returns:
nothing

drop_anchor(self, ankcls, ankkw)

source code 

Create an anchor object and append it to the solver muscle.

Parameters:
  • ankcls (type) - anchor type.
  • ankkw (dict) - keywords to the constructor of the anchor.
Returns:
nothing