Show More
@@ -1,4 +1,17 b'' | |||||
1 | """Example of iteration through AsyncMapResult, without waiting for all results |
|
1 | """Example of iteration through AsyncMapResults, without waiting for all results | |
|
2 | ||||
|
3 | When you call view.map(func, sequence), you will receive a special AsyncMapResult | |||
|
4 | object. These objects are used to reconstruct the results of the split call. | |||
|
5 | One feature AsyncResults provide is that they are iterable *immediately*, so | |||
|
6 | you can iterate through the actual results as they complete. | |||
|
7 | ||||
|
8 | This is useful if you submit a large number of tasks that may take some time, | |||
|
9 | but want to perform logic on elements in the result, or even abort subsequent | |||
|
10 | tasks in cases where you are searching for the first affirmative result. | |||
|
11 | ||||
|
12 | By default, the results will match the ordering of the submitted sequence, but | |||
|
13 | if you call `map(...ordered=False)`, then results will be provided to the iterator | |||
|
14 | on a first come first serve basis. | |||
2 |
|
15 | |||
3 | Authors |
|
16 | Authors | |
4 | ------- |
|
17 | ------- |
General Comments 0
You need to be logged in to leave comments.
Login now