diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-06-06 23:41:20 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-06-07 00:05:09 +0200 |
commit | 6a252661c3bf4202a4d571f9c41d2afa48d9d75f (patch) | |
tree | 6c46c78078d91aa90b93f18b9c32215b4be57ee0 /lib/git/async/task.py | |
parent | 867129e2950458ab75523b920a5e227e3efa8bbc (diff) | |
download | gitpython-6a252661c3bf4202a4d571f9c41d2afa48d9d75f.tar.gz |
pool: First version which works as expected in async mode. Its just using a single task for now, but next up are dependent tasks
Diffstat (limited to 'lib/git/async/task.py')
-rw-r--r-- | lib/git/async/task.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/git/async/task.py b/lib/git/async/task.py index ec650237..3137746c 100644 --- a/lib/git/async/task.py +++ b/lib/git/async/task.py @@ -7,7 +7,13 @@ class OutputChannelTask(Node): additional information on how the task should be queued and processed. Results of the item processing are sent to an output channel, which is to be - set by the creator""" + set by the creator + + * **min_count** assures that not less than min_count items will be processed per call. + * **max_chunksize** assures that multi-threading is happening in smaller chunks. If + someone wants all items to be processed, using read(0), the whole task would go to + one worker, as well as dependent tasks. If you want finer granularity , you can + specify this here, causing chunks to be no larger than max_chunksize""" __slots__ = ( '_read', # method to yield items to process '_out_wc', # output write channel '_exc', # exception caught @@ -42,7 +48,6 @@ class OutputChannelTask(Node): def process(self, count=0): """Process count items and send the result individually to the output channel""" items = self._read(count) - try: if self.apply_single: for item in items: @@ -58,6 +63,9 @@ class OutputChannelTask(Node): # if we didn't get all demanded items, which is also the case if count is 0 # we have depleted the input channel and are done + # We could check our output channel for how many items we have and put that + # into the equation, but whats important is that we were asked to produce + # count items. if not items or len(items) != count: self.set_done() # END handle done state |