IMP Reference Guide
develop.63b38c487d,2024/12/21
The Integrative Modeling Platform
|
A collection of tasks that run in the same environment. More...
A collection of tasks that run in the same environment.
Context objects are typically created by calling Manager::get_context().
Definition at line 330 of file parallel/__init__.py.
Public Member Functions | |
def | __init__ |
Constructor. More... | |
def | add_task |
Add a task to this context. More... | |
def | get_results_unordered |
Run all of the tasks on available workers, and return results. More... | |
def IMP.parallel.Context.__init__ | ( | self, | |
manager, | |||
startup = None |
|||
) |
Constructor.
Definition at line 334 of file parallel/__init__.py.
def IMP.parallel.Context.add_task | ( | self, | |
task | |||
) |
Add a task to this context.
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 worker its arguments are the return value from this context's startup function.
Definition at line 341 of file parallel/__init__.py.
def IMP.parallel.Context.get_results_unordered | ( | self | ) |
Run all of the tasks on available workers, and return results.
If there are more tasks than workers, subsequent tasks are started only once a running task completes: each worker 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.
NoMoreWorkersError | there are no workers available to run the tasks (or they all failed during execution). |
RemoteError | a worker encountered an unhandled exception. |
NetworkError | the manager lost (or was unable to establish) communication with any worker. |
Definition at line 357 of file parallel/__init__.py.