Artifact for API Recache Flow - #65
Draft
charparr wants to merge 5 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the API recache flow by adding a post-run Prefect Artifact that provides a detailed analysis report of API route responses.
- Added an extended docstring and summary reporting prints to inform users of the flow results.
- Updated the flow execution to capture and log detailed statistics including total requests and artifact IDs.
- Modified the serve function parameters to include an additional "Analytics" tag and a refined description.
Comments suppressed due to low confidence (1)
recache_api/recache.py:9
- [nitpick] Enhance the docstring to include parameter and return descriptions to improve clarity and aid future maintenance.
Recache API endpoints and generate performance analysis artifacts.
| and automatically generates a detailed analysis report as a Prefect artifact | ||
| visible in the dashboard. | ||
| """ | ||
| print("🔄 Starting Prefect Recaching Flow with automatic analysis...") |
There was a problem hiding this comment.
Consider using Prefect's built-in logging methods instead of print statements for more flexible log management and integration with the Prefect dashboard.
Suggested change
| print("🔄 Starting Prefect Recaching Flow with automatic analysis...") | |
| logger = get_run_logger() | |
| logger.info("🔄 Starting Prefect Recaching Flow with automatic analysis...") |
brucecrevensten
marked this pull request as draft
June 18, 2025 18:34
Member
|
This needs significant revision to reduce complexity and avoid unnecessary code, possibly a fresh start, will review further after launch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR simply adds a post-flow-run Prefect Artifact object to the API re-cache flow. To view the artifact, run the flow as normally for a set of routes: more routes will take longer, but will be a more robust test and create a more interesting report. The report summarizes response codes for the different routes that are being cached. You shouldn't need to configure the re-ache flow in any special way. Just run the flow, but if you want a minimum viable test just cancel the flow after 15 minutes or so to see a report.
To view the report Artifact, go to the flow run in the Prefect Dashboard, and click the the "Artifact" tab, and then click the Artifact Item.
I've tried to highlight routes that get a 5xx response, so you get a report on every single URL that has a 5xx status.
A 404 or 200 is considered a "healthy" response. Our 404 usage is pretty solid IMO.