next up previous contents index
Next: sge_pe_job() create Up: Parallel job support Previous: Parallel job support   Contents   Index

job() -- create a new parallel job

job(seq=(), modeller_path=None, host=None)
This creates a new job object, used to keep track of multiple slave processes. It is initially empty, but acts just like an ordinary Python list, so you can add or remove slave objects (see below) using ordinary list operations (e.g., append, del). Also, if you provide a list of suitable slave objects to job(), they will automatically be added.

Each slave runs a MODELLER process. The system attempts to start this process in the same way as the MODELLER script used for the master. If the master is run using your machine's system Python, the slave is started by running 'python bin/modslave.py', while if the master was started using the 'mod9.13' script, the slave will be too. In some cases, it may get this command line wrong, in which case you can specify the command explicitly using the modeller_path variable. For example, set it to 'mod9.13' to force it to use the version of Python built in to MODELLER rather than the system Python.

Each slave, when started, tries to connect back over the network to the master node. By default, they try to use the fully qualified domain name of the machine on which you create the job object (the master). If this name is incorrect (e.g., on multi-homed hosts) then specify the true hostname with the host parameter. You can also set host to 'localhost' if your machine does not have network connectivity and/or you are running only local slaves.

Each slave will run in the same directory as the master, so will probably fail if you do not have a shared filesystem on all nodes. The output from each slave is written to a logfile called '${JOB}.slaveN' where '${JOB}' is info.jobname and 'N' is the number of the slave, starting from zero.

job.slave_startup_commands is a Python list, initially empty, of Python commands that will be run on each slave when it is started up. You can add your own slave initialization by adding to this list.

Once you have created the job, to use the task interface, submit one or more tasks with job.queue_task(), and then run the tasks with job.run_all_tasks() or job.yield_tasks_unordered().

To use the message-passing interface, first start all slaves with job.start(), and then use Communicator.send_data(), Communicator.get_data() and slave.run_cmd() to pass messages and commands.

Example: See job.start(), job.run_all_tasks() command.


next up previous contents index
Next: sge_pe_job() create Up: Parallel job support Previous: Parallel job support   Contents   Index
Automatic builds 2014-02-11