next up previous contents index
Next: Communicator.get_data() get Up: Parallel job support Previous: job.start() start   Contents   Index

Communicator.send_data() -- send data

send_data(data)
This sends the given data to the communicator. For sending from the master to slaves, this communicator is simply the 'slave' object itself. For sending from the slaves back to the master, a communicator called 'master' is provided for you.

Any data that can be processed by the Python 'pickle' module can be sent to and from slaves. This includes most Python objects, simple data such as integer and floating point numbers, strings, and many MODELLER objects. Note, however, that internal MODELLER data is not passed in these objects, so if, for example, you were to pass a model object, it would contain no atoms when it reached the slave. For complex data such as this, write it to a file at one end and read it back at the other.

It is an error for the master to send data to a slave using this function, unless the slave is already waiting for data (i.e., by itself calling Communicator.get_data()). Generally this means you should call slave.run_cmd() before Communicator.send_data().

If there is a problem with the network, this function will raise a NetworkError exception. You can trap this to rerun the calculation on a different slave, for example. Any other errors (e.g., a syntax error in your script) will raise a RemoteError exception.


next up previous contents index
Next: Communicator.get_data() get Up: Parallel job support Previous: job.start() start   Contents   Index
Automatic builds 2011-03-29