Home | Trees | Indices | Help |
|
---|
|
TrackingJobMaster
This class extends JobMaster with the following extras:The calculation is performed non-blocking in a thread after a call to master.start(). The end of calculation is signalled on master.lock / master.lockMsg. The result can then be obtained with getResult().
Alternatively, a callback method can be registered that is called after the calculation finished (master.setCallback()).
The perhaps easiest (but also least flexible) way is to instead use the calculateResult() method. This starts the calculation and blocks execution until the result is returned.
Consider overriding cleanup(), done() and getResult().
An interrupted calculation can be restarted from a restart file:Note: The master sends out an exit signal to all slaves but doesn't wait for a response (there isn't any) and continues in the finish() method. Since, at the end, the same job is distributed to several slaves, some of them might still be running when cleanup() or done() are executed. The slave script must tolerate errors that, e.g., happen if cleanup() is called while it is running.
To Do:
|
|||
| __init__(self, data={}, chunk_size=5, hosts=[], niceness={'default': 20}, slave_script='', verbose=1, show_output=0, add_hosts=1, redistribute=1) | ||
|
hostnameFromTID(self,
slave_tid) Get nickname of host from TaskID. |
||
|
is_valid_slave(self,
slave_tid) Override JobMaster method to disable slow nodes on the fly |
||
| mark_slow_slaves(self, host_list, slow_factor) | ||
|
start_job(self,
slave_tid) Overriding JobMaster method |
||
|
job_done(self,
slave_tid,
result) Overriding JobMaster method |
||
|
reportProgress(self) Report how many jobs were processed in what time per host. |
||
|
setCallback(self,
funct) Register function to be called after calculation is finished. |
||
|
cleanup(self) Called after exit. |
||
|
done(self) Called by finish() after exit(), cleanup(), and reportProgress(), but before thread notification (notifyAll() ) and before executing the callBack method. |
||
|
notifyAll(self) Notify thread waiting on self.lockMsg that master has finished. |
||
|
finish(self) Called one time, after last job result has been received. |
||
{any:any}
|
getResult(self,
**arg) Return result dict, if it is available. |
||
array
|
calculateResult(self,
**arg) Convenience function that is starting the parallel calculation and blocks execution until it is finished. |
||
dict
|
getRst(self) Get data necessary for a restart of the running calculation. |
||
|
saveRst(self,
fname) Pickle data necessary for a restart of the running calculation. |
||
dict
|
setRst(self,
rst_data) Prepare this master for restart, called by restart(). |
||
Inherited from Inherited from Inherited from Inherited from Inherited from Inherited from Inherited from Inherited from |
|
|||
Inherited from |
|
|
Get nickname of host from TaskID.
|
Override JobMaster method to disable slow nodes on the fly
|
|
Overriding JobMaster method
|
Overriding JobMaster method
|
Report how many jobs were processed in what time per host. |
Register function to be called after calculation is finished.
|
Called after exit. Override. |
Called by finish() after exit(), cleanup(), and reportProgress(), but before thread notification (notifyAll() ) and before executing the callBack method. Override.
|
Notify thread waiting on self.lockMsg that master has finished. |
Called one time, after last job result has been received. It should not be necessary to override this further. Override done() instead.
|
Return result dict, if it is available. Override to return something else - which will also be the return value of calculateResult().
|
Convenience function that is starting the parallel calculation and blocks execution until it is finished.
|
Get data necessary for a restart of the running calculation. Locks, file handles and private data are *NOT* saved. Override if necessary but call this method in child method.
|
Pickle data necessary for a restart of the running calculation.
|
Prepare this master for restart, called by restart(). Override if necessary but call in child.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0alpha3 on Fri Dec 22 20:11:45 2006 | http://epydoc.sourceforge.net |