Read in parallel and write sequentially?
问题 I have the following code which read and write for each id sequentially. async def main(): while id < 1000: data = await read_async(id) await data.write_async(f'{id}.csv') id += 1 read_async() takes several minutes and write_async() takes less than one minute to run. Now I want to Run read_async(id) in parallel. However, at most 3 calls can be run in parallel because of memory limitation. write_async has to be run sequentially, i.e., write_async(n+1) cannot be run before write_async(n) . 回答1: