Ofir
08/26/2022, 1:29 PMtry:
import prefect
except ImportError
def @task(func): return func
?Ryan Peden
08/26/2022, 2:06 PMfrom prefect import flow, task
from your_module import preprocessing_function
from your_other_module import training_function
@task
def preprocess_data():
preprocessing_function()
@task
def train():
training_function()
@flow(name='My pipeline')
def process_and_train():
preprocess_data()
train()
This would let you introduce Prefect gradually without needing to alter your existing code - so anyone who wants to keep using the code base as-is can do so, and anyone who wants to use the Prefect flows you are building can install Prefect.Ofir
08/26/2022, 2:18 PM