-
Notifications
You must be signed in to change notification settings - Fork 29
SEAB-7194: Add max weekly execution count endpoint #6156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SEAB-7194: Add max weekly execution count endpoint #6156
Conversation
| for (int i = 0, n = values.size(); i < n; i++) { | ||
| Instant binStart = oldestBinStart.plusSeconds(i * secondsPerWeek); | ||
| Instant binEnd = binStart.plusSeconds(secondsPerWeek); | ||
| if (binEnd.compareTo(onOrAfter) >= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this could be calculated in the JPA with a "max", but this is maybe known given
This endpoint may be ephemeral, it might be supplanted when we implement workflow-level metrics support.
| @NamedQuery(name = "io.dockstore.webservice.core.Workflow.getWorkflowIdsEligibleForRetroactiveDoi", query = "SELECT DISTINCT w.id FROM Workflow w JOIN w.workflowVersions v LEFT JOIN v.versionMetadata vm LEFT JOIN vm.dois d WHERE w.isPublished AND w.autoGenerateDois AND NOT w.archived AND v.referenceType = 'TAG' AND v.valid AND NOT vm.hidden AND d IS NULL"), | ||
| @NamedQuery(name = "io.dockstore.webservice.core.Workflow.getWorkflowIdsWithGitHubOrManualDoi", query = "SELECT DISTINCT w.id FROM Workflow w JOIN w.workflowVersions v JOIN v.versionMetadata vm JOIN vm.dois d WHERE d.initiator IN ('GITHUB', 'USER')") | ||
| @NamedQuery(name = "io.dockstore.webservice.core.Workflow.getWorkflowIdsWithGitHubOrManualDoi", query = "SELECT DISTINCT w.id FROM Workflow w JOIN w.workflowVersions v JOIN v.versionMetadata vm JOIN vm.dois d WHERE d.initiator IN ('GITHUB', 'USER')"), | ||
| @NamedQuery(name = "io.dockstore.webservice.core.Workflow.getWeeklyExecutionCountsForAllVersions", query = "SELECT VALUE(c).weeklyExecutionCounts FROM Workflow w JOIN w.workflowVersions v JOIN v.metricsByPlatform mbp ON KEY(mbp) = 'ALL' JOIN VALUE(mbp).executionStatusCount esc JOIN esc.count c ON KEY(c) = 'ALL' WHERE w.id = :id AND VALUE(c).weeklyExecutionCounts IS NOT NULL"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could narrow things down by feeding the time into the query and not returning counts for versions that were not updated anywhere near onOrAfterEpochSecond
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6156 +/- ##
=============================================
+ Coverage 72.32% 74.03% +1.70%
- Complexity 5537 5712 +175
=============================================
Files 397 397
Lines 20522 20540 +18
Branches 2108 2111 +3
=============================================
+ Hits 14842 15206 +364
+ Misses 4683 4331 -352
- Partials 997 1003 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Description
This PR adds an endpoint that calculates the maximum weekly execution count for all versions of a workflow, for all weeks on/after a specified date.
The UI will use this endpoint to calculate the maximum Y axis value for the "small multiples" weekly execution count graphs that are being added to the versions table.
Alternatively, we could calculate the maximum client-side, by simply downloading all the versions with their metrics. However, that would be a potentially huge amount of information (some of the broad repos have more than 1000 versions) and could take seconds.
This endpoint may be ephemeral, it might be supplanted when we implement workflow-level metrics support.
The code that calculates the maximum is written with robustness in mind. It could be more efficient, but in this case, it's ok if we burn a few extra cycles.
Review Instructions
Try a few queries (like the following) and confirm that the response is rational:
Issue
https://ucsc-cgl.atlassian.net/browse/SEAB-7194
Security and Privacy
If there are any concerns that require extra attention from the security team, highlight them here and check the box when complete.
e.g. Does this change...
Please make sure that you've checked the following before submitting your pull request. Thanks!
mvn clean install@RolesAllowedannotation