alphatwirl.concurrently.TaskPackageDropbox

class alphatwirl.concurrently.TaskPackageDropbox(workingArea, dispatcher, sleep=5)[source]

A drop box for task packages.

This class puts task packages in a working area and have dispatchers execute the tasks.

Parameters:
  • workingArea – A working area, an instance of WorkingArea
  • dispatcher – A dispatcher
  • sleep (float) – A time interval between each query while waiting a task to finish.
__init__(workingArea, dispatcher, sleep=5)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(workingArea, dispatcher[, sleep]) Initialize self.
close() close the drop box
open() open the drop box
poll() return pairs of package indices and results of finished tasks
put(package) put a task
put_multiple(packages) put tasks
receive() return pairs of package indices and results of all tasks
receive_one() return a pair of a package index and result of a task
terminate() terminate the drop box