Before this change, when a generator function is passed to pipeline, the pipeline converts the function so that output won't be propagated until the generator gets exhausted.
This is to support the case for running generator in subprocess, in which case, the ProcessPoolExecutor or asyncio does not support returning yielded items one-by-one.
This restriction is not applicable if running the generator in the main process.
This commits change the behavior for the case where the generator is executed in the main process, so that the items yielded are passed done immediately.
Before this change, when a generator function is passed to pipeline, the pipeline converts the function so that output won't be propagated until the generator gets exhausted.
This is to support the case for running generator in subprocess, in which case, the ProcessPoolExecutor or asyncio does not support returning yielded items one-by-one.
This restriction is not applicable if running the generator in the main process.
This commits change the behavior for the case where the generator is executed in the main process, so that the items yielded are passed done immediately.