https://prefect.io logo
Title
j

John Ramirez

01/02/2020, 5:03 PM
Hey everyone - I am trying to use the
result_handler
with an
@task
with no success. Does anyone have a good example to demonstrate how to code it
c

Chris White

01/02/2020, 5:07 PM
Hi John - could you share some more detail about what isn’t working?
j

John Ramirez

01/02/2020, 5:09 PM
im pulling from an API in a mapping operation and rather than uploading the results to s3 manually, I want to use the result handler to do it for me
but in the testing the results are not being stored in s3
c

Chris White

01/02/2020, 5:13 PM
if you are running in Core alone, result handlers are rarely called; in this case you will want to set
@task(checkpoint=True)
on your task as well as set the environment variable
PREFECT__FLOWS__CHECKPOINTING=true
. This is outlined here: https://docs.prefect.io/core/concepts/persistence.html#checkpointing
j

John Ramirez

01/02/2020, 5:15 PM
what about in the cloud?
c

Chris White

01/02/2020, 5:17 PM
At this moment, all you need to do is set
checkpoint=True
to ensure your task’s result handlers are called in Cloud. With the release of Core 0.9.0 checkpointing will become default behavior, so your tasks will always have their result handlers called