Jovan Visnjic
08/28/2020, 9:13 AMPrefectResult
with prefect core server running on my local machine. According to the docs, I understood that it should cache the result in prefect's database. I am running this simple example, extended from the one in the docs, I just added random raising of exceptions:
@task(result=PrefectResult())
def add(x, y=1):
if random.random() > 0.7:
raise Exception('I failed on purpose')
return x + y
with Flow("my handled flow!") as flow:
first_result = add.map(list(range(10)), y=unmapped(2))
When I restart the flow, it doesn't just run the failed mapped tasks, It runs all of them again, also the successful ones. On the other hand it works fine if I use LocalResult
. Am I missing something? Any help would be much appreciated.nicholas
08/28/2020, 1:23 PMJovan Visnjic
08/28/2020, 1:34 PM0.13.2
and I'm restarting flows from the UI.nicholas
08/28/2020, 2:50 PMPrefectResult()
doesn't provide out of the box; it instead provides data persistence for tasks in the event of failure. To allow re-use of the data you'll need to use a cache pattern (like cache_for
and cache_validator
). You can read more about that here.Jovan Visnjic
08/31/2020, 7:05 AM