<@ULVA73B9P> using prefect 2.x.x, I've deleted the result file of a flow, and now the flow errors wi...
d
@Marvin using prefect 2.x.x, I've deleted the result file of a flow, and now the flow errors with ValueError: Path /path/to/result does not exist. How can I reset the prefect server to handle this.
1
m
In Prefect 2.x, when you encounter the error
ValueError: Path /path/to/result does not exist
after deleting a result file, it's because Prefect tries to retrieve previously persisted results by default in some cases like task caching, flow retries, etc. Since the result file is missing, this retrieval process fails. To address this issue, you need to take one of the following actions: 1. Disable result persistence for the flow (if unnecessary): You can adjust the flow's configuration to not use persisted results, thereby not looking for a result file that may not exist. This can be done by setting
persist_result
to
False
in your flow or task decorators:
Copy code
python
   from prefect import flow
   
   @flow(persist_result=False)
   def my_flow():
       # your flow logic
       pass
2. Recreate the result files: If the results are necessary for your flow logic, you might want to rerun the tasks or flows to regenerate the required result files. 3. Adjust Prefect server settings: If the flow run itself is stuck due to missing results, you might need to inspect Prefect server states or remove problematic runs manually from the database. For further and detailed interaction with Prefect server, refer to official documentation: - Prefect Result Handling Concepts If you need more information on troubleshooting this kind of error, you can check the GitHub issue discussion for additional context: Github Issue #6779. Let me know if you need any more help!
n
hi @Duncan do you actually want to reset the server (ie you have no data you care about) or you specifically want the server to "forget" about those result paths?
d
forget about the results, ideally, but can do either
n
nuclear option:
Copy code
» rm ~/.prefect/prefect.db && prefect server database reset -y
Downgrading database...
Upgrading database...
Prefect database "sqlite+aiosqlite:////Users/nate/.prefect/prefect.db" reset!
or in 2.x if you need to tell tasks to not use their cache (this is less awkward in 3.x) you'd need to add
refresh_cache=True
to the task that's trying to pull its result like this
1
d
yeah that's got me going again, cheers
catjam 1