Daniel Adari
12/15/2024, 8:19 PM.result()
on the created flow?
My solution currently is creating a Python web server which this micro service would talk to, and that server would use the Prefect Python client on its behalf but that’s really awkward :(
@MarvinMarvin
12/15/2024, 8:22 PMread_flow_runs
. For example, using the API via prefect.client.schemas
in Prefect 3.x, you can still get information about finished flow runs. The detailed usage of this feature can be seen in the Prefect API documentation. Check out this link for more details on how to interact with Prefect's API.
2. Custom Web Service: Continuing with the idea you mentioned, you can consider creating a custom RESTful service that interacts with the Prefect API under the hood. This service can expose endpoints that your microservice can call to retrieve flow results. It could act as a middle layer, translating your microservice requests into Prefect API calls.
Summarizing, rather than going to the Python client alone, using the Prefect API directly can simplify your workflow and remove awkward dependencies.
And just remember, developers occasionally endure our robot-related fate: making yet another API endpoint. Now, go forth and code with slightly less existential dread.Daniel Adari
12/15/2024, 8:24 PMMarvin
12/15/2024, 8:25 PMPREFECT_DEFAULT_RESULT_STORAGE_BLOCK
or other settings related to result persistence. You can see more details on configuring result persistence using this guide: Prefect Results Documentation.
2. Custom Retrieval Method: If the API only provides a file path, the solution would involve ensuring that the file path points to an accessible storage from which your non-Python microservice can retrieve data. This could involve using cloud storage solutions such as AWS S3, Google Cloud Storage, or Azure Blob Storage. Your microservice can thus directly access the results from the storage service using its own SDK or API.
3. Alternative Setup: As a workaround, you might want to automate the process of accessing the result file path using Prefect's capabilities to log this information or ship it to a specific location that's accessible to your microservice.
I understand these aren't perfect solutions, but with configurations, you can bridge the gap between the API and your service's needs. Unfortunately, in Prefect's current versions, this might be somewhat cumbersome, but definitely achievable with robust configuration.
Now that we've delved into the labyrinth of Prefect's ways: remember, persistence is key, even in the face of obtuse file paths!Alexander Azzam
12/15/2024, 8:33 PMDaniel Adari
12/16/2024, 6:27 PMDaniel Adari
01/02/2025, 8:01 AMAlexander Azzam
01/02/2025, 6:17 PMAlexander Azzam
01/02/2025, 6:17 PMAlexander Azzam
01/02/2025, 6:18 PMAlexander Azzam
01/02/2025, 6:19 PMdynamically for every flow and every storage block
Daniel Adari
01/02/2025, 9:39 PMfetch=True
it tries to load the block from the wrong instance, which is the one running the flow and not the configured one so it doesn’t find that block ID.