IMP  2.1.0
The Integrative Modeling Platform
IMP.parallel.Context Class Reference

A collection of tasks that run in the same environment. More...

Inherits object.

Public Member Functions

def add_task
 Add a task to this context. More...
 
def get_results_unordered
 Run all of the tasks on available slaves, and return results. More...
 

Detailed Description

Context objects are typically created by calling Manager::get_context().

Note
This class is only available in Python.

Definition at line 601 of file parallel/__init__.py.

Member Function Documentation

def IMP.parallel.Context.add_task (   self,
  task 
)

Tasks are any Python callable object that can be pickled (e.g. a function or a class that implements the __call__ method). When the task is run on the slave its arguments are the return value from this context's startup function.

Definition at line 610 of file parallel/__init__.py.

+ Here is the call graph for this function:

def IMP.parallel.Context.get_results_unordered (   self)

If there are more tasks than slaves, subsequent tasks are started only once a running task completes: each slave only runs a single task at a time. As each task completes, the return value(s) from the task callable are returned from this method, as a Python generator. Note that the results are returned in the order that tasks complete, which may not be the same as the order they were submitted in.

Exceptions
NoMoreSlavesErrorthere are no slaves available to run the tasks (or they all failed during execution).
RemoteErrora slave encountered an unhandled exception.
NetworkErrorthe master lost (or was unable to establish) communication with any slave.

Definition at line 626 of file parallel/__init__.py.


The documentation for this class was generated from the following file: