The as_completed function allows us to work with the results returned from all of our executed tasks as and when they are returned. These results could then be fed into a series of other coroutines for further processing or just simply logged somewhere depending on what your needs are.
We can use the as_completed() function as follows and iterate over the completed futures as and when they are returned:
for f in as_completed(fs):
result = yield from f
# Use result