Communicator.send_data() — send data

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

Any data that can be processed by the Python 'pickle' module can be sent to and from workers. 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 worker. 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 manager to send data to a worker using this function, unless the worker is already waiting for data (i.e., by itself calling Communicator.get_data()). Generally this means you should call Worker.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 worker, for example. Any other errors (e.g., a syntax error in your script) will raise a RemoteError exception.