Brian Newman
05/02/2024, 3:07 PMprefect.exceptions.MissingResult: State data is missing. Typically, this occurs when result persistence is disabled and the state has been retrieved from the API.
Finished in state Failed('Flow run encountered an exception. MissingResult: State data is missing. Typically, this occurs when result persistence is disabled and the state has been retrieved from the API.')
Jake Kaplan
05/02/2024, 4:15 PMVadym Shkarbul
05/06/2024, 7:20 AM@task(
# cache_key_fn=task_input_hash
)
But it is still not clear what updates on the night of May 2 to 3 caused thisBrad
05/06/2024, 7:52 AMdef test_missing_result():
# Arrange
from prefect import task
from prefect.tasks import task_input_hash
@task(
persist_result=True,
cache_key_fn=task_input_hash,
)
def fail_task():
return {"hello": "world"} # Force a PersistedResult
@flow()
def fail_flow(refresh: bool):
f = fail_task.with_options(refresh_cache=refresh).submit()
return f.result(raise_on_failure=False)
# Act
first_result = fail_flow(refresh=True)
second_result = fail_flow(refresh=False) # < --- fails here trying to read from cache
# Assert
assert first_result == {"hello": "world"}
assert first_result == second_result
Jake Kaplan
05/06/2024, 11:52 AM