3.5. pyopus.parallel.jobdispatch — Parallel job dispatcher based on the evtdrvms module (obsolete)

Inheritance diagram of pyopus.parallel.jobdispatch

Master-slave job dispatcher (PyOPUS subsystem name: JD)

A simple asynchronous parallel job dispatcher. If no vm object is supplied, the jobs are evaluated locally. This module is based on pyopus.parallel.evtdrvms and is therefore obsolete. It will be removed in the next release. Use pyopus.parallel.cooperative.OpusOS.dispatch() method instead.

class pyopus.parallel.jobdispatch.JobDispatcher(vm=None, maxSlaves=None, minSlaves=0, debug=0)

An asyncronous parallel job dispatcher.

vm is the virtual machine object. If it is not given the jobs are evaluated locally.

maxSlaves and minSlaves specify the maxiaml and the minimal number of parallel processes.

A nonzero value of debug turns on debug messages.

Derive from this class and reimplement the first four methods. Invoke the evaluation by calling the run() method.

fillHandlerTable()

Fills the handler table of the EventDrivenMS object with the handlers that take care of the parallel point evaluator’s messages.

handleEvaluateJob(source, message)

Handles MsgEvaluateJob messages received by slaves. Evaluates the received job and sends back a MsgResult message.

handleIdle(source, message)

Handles a MsgIdle message.

Distributes work to the slaves by sending them MsgEvaluateJob messages.

handleResult(source, message)

Handles a MsgResult message and takes care of the job result.

Marks the slave that sent the message as idle so that new work can be assigned to it by the MsgIdle message handler.

handleSlaveStarted(source, message)

Handles the MsgSlaveStarted message received by the master from a freshly started slave. Does nothing special, just calls the inherited handler from the EventDrivenMS class.

handleStartup(source, message)

Handles a MsgStartup message received by master/slave when the event loop is entered.

Performs some initializations on the master and prevents the plugins in the slave from printing messages.

handleTaskExit(source, message)

Handles a notification message reporting that a slave has failed (is down).

Stores the work that was performed at the time the slave failed so it can later be reassigned to some other slave.

nextJob()

Returns the next job to dispatch.

Returns None when there are no more jobs available.

Should be reimplemented by a derived class.

postProcess()

Postprocesses the results after all jobs are finished. Should be reimplemented by a derived class.

processJob(job)

Runs the given job and returns the results. Should be reimplemented by a derived class.

processResult(job, result)

Handles the returned result Should be reimplemented by a derived class.

reset()

Resets the dispatcher. Should be reimplemented by a derived class.

run()

Runs the algorithm.

Previous topic

3.4. pyopus.parallel.evtdrvms — Master-slave event-driven algorithm model (obsolete)

Next topic

4. pyopus.optimizer — Optimization algorithms

This Page