Job.queue_task() — submit a task to run within the job

queue_task(taskobj)
This adds the given Task object to the job's queue. All tasks in the queue can later be run with Job.run_all_tasks() or Job.yield_tasks_unordered().

The task should be a instance of a class derived from Task, which provides a 'run' method. This method will be run on the worker node; any arguments to this method are given on the manager when the object is created, and are automatically passed for you to the worker. Anything you return from this method is automatically passed back to the manager. (Note that Communicator.send_data() is used to send this data, which cannot send all internal MODELLER types.)

Note that generally you need to declare tasks in a separate Python module, and load them in with the import statement, as the tasks are passed using Python's pickle module, which will otherwise give an error such as 'AttributeError: 'module' object has no attribute 'mytask''.
Example: See Job.run_all_tasks() command.