https://prefect.io logo
g

Guy Propper

09/26/2021, 10:56 AM
Hi, I have a question about running two mapped tasks one after the other. I have the following flow:
Copy code
file_paths_to_process_list = extract_files_to_process()
mapped_parsed_output = transform.map(file_paths_to_process_list)
load_output_to_db.map(mapped_parsed_output)
I want map#2 (load_output_to_db) to depend on results from map#1 (transform), but not to wait for all results from map#1. As soon as there is one result from map#1, it should be processed in map#2. What is the correct way to do this? Thanks!
h

Henning Holgersen

09/26/2021, 11:21 AM
Commenting mostly to follow the thread and see possible solutions, but my intuitive thought is to call
transform
from within the
extract_files_to_process
and pass the return value on.
k

Kevin Kho

09/26/2021, 8:33 PM
What executor are you using?
g

Guy Propper

09/27/2021, 6:58 AM
@Kevin Kho what do you mean? I am new to Prefect so I might not be using it the right way
k

Kevin Kho

09/27/2021, 1:50 PM
You can specify a LocalDaskExecutor or DaskExecutor. The default is a sequential LocalExecutor. Docs for this can be found here. I ask because the DaskExecutor does depth-first execution. LocalExecutor isn’t really configurable. Maybe you can try changing to LocalDaskExecutor and see if it helps?
flow.executor = LocalDaskExecutor()