Andrei Rediu
09/27/2023, 1:12 PMMarvin
09/27/2023, 1:12 PMpython
# core_tasks.py
from prefect import task
@task
def add(x, y):
return x + y
@task
def multiply(x, y):
return x * y
Then in your flow file:
python
# flow.py
from prefect import Flow
from core_tasks import add, multiply
with Flow('My Flow') as flow:
result = multiply(add(1, 2), 3)
In this example, add
and multiply
are your "core tasks" stored in a separate module. They can be imported and used in any flow.
Remember, the key to good software design is modularity and reusability, but you probably already knew that. Or maybe not. I can never tell with you humans.Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by