Package Biskit :: Package PVM :: Module dispatcher :: Class JobMaster
[hide private]
[frames] | no frames]

Class JobMaster

source code


Instance Methods [hide private]
  __init__(self, data, chunk_size, hosts, niceness, slave_script, show_output=0, result=None, redistribute=1, verbose=1)
  start(self)
Start slave job
  getInitParameters(self, slave_tid)
Override to collect slave initiation parameters.
  done(self)
Override to do something after last job result has been received.
  finish(self)
This method is called one time, after the master has received the last missing result.
  __finish(self)
Call finish(); but only call it once.
  bindMessages(self, slave_tid)
int spawn(self, host, nickname, niceness, show_output=0)
Spawn a job.
  spawnAll(self, niceness, show_output=0)
Spawn many jobs.
  initializationDone(self, slave_tid)
is called by a slave that has been initialized and is now ready for start-up.
  start_job(self, slave_tid)
Called when a new job is about to be started.
{any:any} get_slave_chunk(self, data_keys)
Assemble task dictionary that is send to the slave for a single job.
  __start_job(self, slave_tid)
Tasks performed befor the job is launched.
  is_valid_slave(self, slave_tid)
Checked each time before a new job is given to a slave, if 0, the job is given to another slave.
  job_done(self, slave_tid, result)
Override to add tasks to be preformend when the job is done (other than the default, see __job_done).
  __job_done(self, slave_tid, result)
Tasks that are preformed when the job is done.

Inherited from PVMThread.PVMMasterSlave: exit, initialize, messageLoopIsUp, startMessageLoop

Inherited from PVMThread.PVMThread: bind, getBindings, getMessageLoopDelay, getParent, getPingTimeout, getTID, getTasks, isStopped, log, messageLoopIsStopped, nicknameFromTID, ping, post, post_execute_method, post_message_received, post_message_sent, rm_log, run, send, sendToAll, send_primitive, setMessageLoopDelay, setPingTimeout, stop, stopMessageLoop, unbind

Inherited from PVMThread.PVMThread (private): _ping

Inherited from threading.Thread: __repr__, getName, isAlive, isDaemon, join, setDaemon, setName

Inherited from threading.Thread (private): _set_daemon

Inherited from threading._Verbose (private): _note

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__


Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, data, chunk_size, hosts, niceness, slave_script, show_output=0, result=None, redistribute=1, verbose=1)
(Constructor)

source code 
Parameters:
  • data (dict) - {id:object}.
  • chunk_size (int) - number of items that are processed by a job
  • hosts ([str]) - list of host-names
  • niceness (dict) - nice dictionary [host-name: niceness]
  • slave_script (str) - absolute path to slave-script
  • result (dict) - items which have already been processed (ie. they are contained in result) are not processed again.
  • redistribute (1|0) - at the end, send same job out several times (default: 1)
  • verbose (1|0) - verbosity level (default: 1)
Overrides: PVMThread.PVMMasterSlave.__init__

start(self)

source code 

Start slave job
Overrides: threading.Thread.start

getInitParameters(self, slave_tid)

source code 

Override to collect slave initiation parameters.
Overrides: PVMThread.PVMMasterSlave.getInitParameters

done(self)

source code 

Override to do something after last job result has been received.

finish(self)

source code 

This method is called one time, after the master has received the last missing result.

__finish(self)

source code 

Call finish(); but only call it once.

bindMessages(self, slave_tid)

source code 
Parameters:
  • slave_tid (int) - slave task tid

spawn(self, host, nickname, niceness, show_output=0)

source code 

Spawn a job.
Parameters:
  • host (str) - host name
  • nickname (str) - host nickname (for uniqueness, i.e more than on job vill be run on a multiple cpu machine)
  • niceness (int) - nice dictionary [host-name: niceness]
Returns: int
slave task tid
Overrides: PVMThread.PVMMasterSlave.spawn

spawnAll(self, niceness, show_output=0)

source code 

Spawn many jobs.
Parameters:
  • niceness (dict) - nice dictionary [host-name: niceness]

initializationDone(self, slave_tid)

source code 

is called by a slave that has been initialized and is now ready for start-up.
Parameters:
  • slave_tid (int) - slave task tid
Overrides: PVMThread.PVMMasterSlave.initializationDone

start_job(self, slave_tid)

source code 

Called when a new job is about to be started. Override to add other startup tasks than the default, see __start_job
Parameters:
  • slave_tid (int) - slave task tid

get_slave_chunk(self, data_keys)

source code 

Assemble task dictionary that is send to the slave for a single job. Override this, if the values of self.data are to be changed/created on the fly.
Parameters:
  • data_keys ([any]) - subset of keys to self.data
Returns: {any:any}
dict mapping the data keys to the actual data values

__start_job(self, slave_tid)

source code 

Tasks performed befor the job is launched.
Parameters:
  • slave_tid (int) - slave task tid

is_valid_slave(self, slave_tid)

source code 

Checked each time before a new job is given to a slave, if 0, the job is given to another slave. Override.
Parameters:
  • slave_tid (int) - slave task tid

job_done(self, slave_tid, result)

source code 

Override to add tasks to be preformend when the job is done (other than the default, see __job_done).
Parameters:
  • slave_tid (int) - slave task tid

__job_done(self, slave_tid, result)

source code 

Tasks that are preformed when the job is done.
Parameters:
  • slave_tid (int) - slave task tid
  • result (dict) - slave result dictionary