https://prefect.io logo
Title
c

Choenden Kyirong

04/12/2023, 5:42 PM
Do folks typically organize their tasks in separate files and then import them into their flows as needed? For example, there are some general tasks that I would most likely use in multiple flows so they do not need to be defined and attached to a particular flow. Curious about this as I see a lot of examples of tasks always being defined within the flow.
d

Deceivious

04/12/2023, 5:44 PM
The answer is yes. If same code is being used alot - we have common task grouped into a single module.
:upvote: 1
c

Choenden Kyirong

04/12/2023, 5:51 PM
@Deceivious gotchya- thanks for confirming
d

Deceivious

04/12/2023, 5:55 PM
dont forget to abuse
with_options
method
c

Choenden Kyirong

04/12/2023, 5:58 PM
hmmm, just reading up on it- haven’t seen it before. Any important use cases for using this? Just off the top of my head I can see how it’s good for clarity if you’re using a task in multiple flows and updating the name for its particular use case?
d

Deceivious

04/12/2023, 5:59 PM
Using different caches / retries / other prefect features for task decorated methods depending on needs of the flow.
c

Choenden Kyirong

04/12/2023, 6:04 PM
right right!