# flow.py
from prefect.engine.result_handlers import LocalResultHandler
# configure on the task decorator
@task(result_handler=LocalResultHandler())
def add(x, y=1):
return x + y
class AddTask(Task):
def run(self, x, y):
return x + y
# or when instantiating a Task object
a = AddTask(result_handler=LocalResultHandler())
with Flow("my handled flow!"):
first_result = add(1, y=2)
second_result = add(x=first_result, y=100)
# flow.py
from prefect.engine.result_handlers import GCSResultHandler
gcs_handler = GCSResultHandler(bucket='prefect_results')
with Flow("my handled flow!", result_handler=gcs_handler):
...