Open tonal opened 3 weeks ago
Hey @tonal! As shown by the type hinting, result_storage
doesn't accept a Path
but instead either accepts a WritableFilesystem
or a str
:
result_storage: Optional[Union[ResultStorage, str]] = None,
and here's the definition of ResultStorage
:
ResultStorage = Union[WritableFileSystem, str]
Prefect requires a WriteableFileSystem
(which is a type of Block
) to be saved server-side so that results can be retrieved for your flow run after the run has been completed. If you update your code to look like this, it should work:
result_storage = LocalFileSystem(basepath='./storage')
result_storage.save("my-result-storage")
@flow
async def test_flow():
print('test')
async def tmain():
flow = test_flow.with_options(
result_storage=result_storage
)
await flow()
def main():
asyncio.run(tmain())
if __name__ == '__main__':
main()
All in all, this is expected behavior, and the error raised is designed to help guide users towards the expected usage. Do you have any suggestions for improving this experience?
Bug summary
Error output:
Version info (
prefect version
output)Additional context
If you change the Path to LocalFileSystem, the error is the same.