Job.run_all_tasks() — run all queued tasks, and return results

This runs all of the tasks in the job's queue on any available worker. When all of the tasks have finished, this functions returns a list of all the return values from the tasks, in the same order that they were submitted.

Tasks are run in a simple round-robin fashion on the available workers. If a worker fails while running a task, that task is automatically resubmitted to another worker. If you submit more tasks than available workers, new workers are automatically added to the job if the job supports this functionality (e.g., SGEQsubJob()).

See also Job.yield_tasks_unordered().
Example: examples/python/

from modeller import *
from modeller.parallel import Task

class MyTask(Task):
    """A task to read in a PDB file on the worker, and return the resolution"""
    def run(self, code):
        env = Environ() = ["../atom_files"]
        mdl = Model(env, file=code)
        return mdl.resolution

Example: examples/python/

from modeller import *
from modeller.parallel import Job, LocalWorker

# Load in my task from (note: needs to be in a separate Python
# module like this, in order for Python's pickle module to work correctly)
from mytask import MyTask

# Create an empty parallel job, and then add 2 worker processes running
# on the local machine
j = Job()

# Run 'mytask' tasks

results = j.run_all_tasks()

print("Got model resolution: " + str(results))