Home | Trees | Indices | Help |
|
---|
|
Base class and trivial implementation for schedulers. New tasks are added with add_task(data, callable). get_results then returns the results (and locks if tasks are pending). In this simple scheduler implementation the tasks are simply executed in the add_task method.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from |
|
|||
n_open_tasks This property counts of submitted but unfinished tasks. |
|||
task_counter This property counts the number of submitted tasks. |
|||
Inherited from |
|
Return self. |
Shutdown the scheduler. It is important that all the calculations have finished when this is called, otherwise the shutdown might fail. |
Initialize the scheduler. result_container -- Instance of ResultContainer that is used to store the results (default is None, in which case a ListResultContainer is used). verbose -- If True then status messages will be printed to sys.stdout.
|
Process the task and store the result. You can override this method for custom schedulers. Warning: When this method is entered is has the lock, the lock must be released here. Warning: Note that fork has not been called yet, so the provided task_callable must not be called. Only a forked version can be called. |
Hook method for shutdown to be used in custom schedulers. |
Store a result in the internal result container. result -- Result data task_index -- Task index. Can be None if an error occured. This function blocks to avoid any problems during result storage. |
Add a task to be executed. data -- Data for the task. task_callable -- A callable, which is called with the data. If it is None (default value) then the last provided callable is used. If task_callable is not an instance of TaskCallable then a TaskCallableWrapper is used. The callable together with the data constitutes the task. This method blocks if there are no free recources to store or process the task (e.g. if no free worker processes are available). |
Get the accumulated results from the result container. This method blocks if there are open tasks. |
Set the callable that will be used if no task_callable is given. Normally the callables are provided via add_task, in which case there is no need for this method. task_callable -- Callable that will be used unless a new task_callable is given. |
Controlled shutdown of the scheduler. This method should always be called when the scheduler is no longer needed and before the program shuts down! Otherwise one might get error messages. |
|
n_open_tasksThis property counts of submitted but unfinished tasks.
|
task_counterThis property counts the number of submitted tasks.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Mar 8 12:39:48 2016 | http://epydoc.sourceforge.net |