https://prefect.io logo
Title
i

Ilhom Hayot o'g'li

05/27/2022, 4:53 PM
Is that possible to use one task in multiple flows in order to follow "don't repeat yourself"? For example I have one task checker that will check difference of db to decide to update or not - that is used many times. So some code reuse maybe handy. Any suggestions? Some simple example, if difference_rows >0 : use task_to_update else : skip all tasks of this flow only
k

Kevin Kho

05/27/2022, 4:54 PM
Is this 1.0 or 2.0?
i

Ilhom Hayot o'g'li

05/27/2022, 4:54 PM
oh yes it is 1.0
k

Kevin Kho

05/27/2022, 4:56 PM
If it’s 1.0 you need to make that custom module available in your execution environment. If you are using Docker-based execution, then it needs to be in the image
What RunConfig are you on?
i

Ilhom Hayot o'g'li

05/27/2022, 5:03 PM
I am running locally
k

Kevin Kho

05/27/2022, 5:03 PM
Check the third example here
i

Ilhom Hayot o'g'li

05/27/2022, 5:04 PM
So what is that?
k

Kevin Kho

05/27/2022, 5:05 PM
You specify the working directory where you can import the common task
flow.run_config = LocalRun(working_dir="/path/to/working-directory")