Repository navigation
perf: list only the page's filer jobs - #196
Conversation
GET /tasks selected all filer jobs in the namespace (!job-type), and each finished outputs filer's job can carry up to about 200 KB of output file logs. Select the filer jobs of the page's matching tasks by their label taskmaster-name (tesk-core#147, tesk-core 0.12.0), in batches of 100 tasks per request. Filer jobs of older taskmasters have no label: if a matching task has no labelled filer job, also list the unlabelled filer jobs (!job-type,!taskmaster-name), so that tasks started before the taskmaster upgrade keep their state. Closes #177 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The unlabelled filer jobs were listed whenever a page's task had no labelled filer job, also for tasks that never get an outputs filer (no outputs). Only the outputs filer counts for a task, so fall back only for tasks whose stored task has outputs or can't be read. Treat filer jobs without labels as unlabelled instead of failing, drop the needless distinct(), and document when the fallback runs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Taskmasters before tesk-core 0.11.0 ran the outputs filer for tasks with inputs, outputs or volumes, not only for tasks with outputs. Skip the fallback to unlabelled filer jobs only for tasks whose stored task has none of them, so that such old tasks keep their state in lists. Parse the stored task once for the check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideImplementationSelect filer jobs for the page's task IDs in bounded batches, and orchestrate the labelled-job lookup with the conditional legacy fallback.
Determine conservatively whether an older task may have filer jobs, while parsing its stored task once for both this check and field reads.
DocumentationExplain the page-scoped filer lookup, its legacy fallback conditions, and why the fallback becomes empty after old tasks are deleted.
TestsVerify labelled selection, batching, empty input, and selection of unlabelled legacy filer jobs in the Kubernetes client wrapper.
Cover the task-level fallback decision, including old task shapes, unreadable stored tasks, and filer jobs without labels.
Exercise task listing against a strict WireMock Kubernetes API and update shared stubs to accept the new filer selectors.
Update trace-advisor expectations for the two filer-listing methods.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #196 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 54 54
Lines 2314 2351 +37
Branches 272 275 +3
=========================================
+ Hits 2314 2351 +37 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Linked issuesChecked at commit b48b632 #177 perf: list only the page's outputs filer jobs · 2 of 3 met
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/test/java/uk/ac/ebi/tsc/tesk/k8s/service/KubernetesClientWrapperTest.java" line_range="491" />
<code_context>
+ @Test
+ public void listFilerJobsOfTasks_inBatches() throws ApiException {
+ List<String> taskIds =
+ IntStream.range(0, KubernetesClientWrapper.FILER_SELECTOR_BATCH_SIZE + 1)
+ .mapToObj(i -> "task-" + i)
+ .collect(Collectors.toList());
</code_context>
<issue_to_address>
**Batch limit can grow unnoticed**
When the batch-size constant is changed to an incorrect larger value, `listFilerJobsOfTasks_inBatches` builds both its input and expected selectors from `FILER_SELECTOR_BATCH_SIZE` (lines 491 and 509–514), so changing that constant to 500 still passes while requests contain 500 task IDs instead of the documented 100.
Assert that `FILER_SELECTOR_BATCH_SIZE` is 100, or use a fixed 101-task fixture and assert the 100-plus-1 split.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: src/test/java/uk/ac/ebi/tsc/tesk/k8s/service/KubernetesClientWrapperTest.java:491
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2.0.0's release prep is merged and tagged without this change, which ships in a later release. Remove its bullet from the 2.0.0 release notes and its item from "To 2.0.0" in the upgrade notes; the next release's notes need the entry. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sourcery withdrew this approval because the latest commits introduced blocking findings.
Summary
GET /tasksread all filer jobs in the namespace (!job-type) on every request that matched at least one task. Since #160, each finished outputs filer's job can carry up to about 200 KB of output file logs. Now it reads only the filer jobs of the page's matching tasks.KubernetesClientWrapper.listFilerJobsOfTasks(taskIds)selects!job-type,taskmaster-name in (<ids>), in batches of 100 tasks per request (about 1.4 KB of selector). Taskmasters of tesk-core 0.12.0 and later put the label on their filer jobs (tesk-core#147).listUnlabelledFilerJobs()selects!job-type,!taskmaster-name.TesServiceImplcalls it only if a page task has no labelled filer job and may have filer jobs. A task may have filer jobs if its stored task has inputs, outputs or volumes, or can't be read (TesKubernetesConverter.mayHaveFilerJobs). Before tesk-core 0.11.0, the taskmaster ran the outputs filer for any of the three. A taskmaster labels all its filer jobs or none, so one labelled job (e.g. the inputs filer's) rules out the fallback. Unlabelled jobs come from taskmasters before 0.12.0, which don't store output file logs, so they are small, and there are none once old tasks are deleted.listAllFilerJobsis removed. The trace advisor covers the two newlist*methods.docs/api.md("Output file logs") explains whatGET /tasksreads and when the fallback runs.docs/index.md("Getting tasks") has a short note.GET /tasksreads only the page's filer jobs by label, with a fallback to the unlabelled filer jobs of taskmasters before tesk-core 0.12.0. It needs no new permissions (it still listsjobs), and old tasks keep their states. Listing gets cheaper once the taskmaster is of tesk-core 0.12.0 or later and the tasks of older taskmasters are deleted. (perf: list only the page's outputs filer jobs #177, perf: list only the page's filer jobs #196)Closes #177
Verification
KubernetesClientWrapperTestandTesServiceImplListTestwere written first and failed (compilation) before the change. The tests for the review fixes (TesKubernetesConverterTest.mayHaveFilerJobsand the fallback cases inTesServiceImplListTest) were written along with the fixes.ListTaskFilerJobsIT. It usesfailOnUnmatchedRequestsand the exact selectors, and covers two cases: labelled and unlabelled filer jobs mixed on one page, and no fallback request when every task has a labelled filer job. The shared list stubs inMockUtilandNoAuthITnow match both filer selectors../mvnw clean verify checkstyle:check: BUILD SUCCESS, with 18572 unit tests and 124 integration tests, all JaCoCo coverage checks met, and 0 Checkstyle violations.spotless:checkcrashes on JDK 21. Instead, I formatted the changed files with google-java-format 1.7--aospon Java 8, the version spotless uses;--dry-runreports nothing. The CI job "Lint" checks this.mkdocs build --strict: passed.CI passedgreen.Sourcery: one thread (the batch test derived its expectations from the constant). Fixed in ffbcaac with a fixed 101-task fixture, and resolved. A second thread said the selector also returns inputs filer jobs. Declined, because no label tells the inputs filer from the outputs filer. The inputs filer jobs are small, and a labelled one is what lets a task skip the fallback.
Review
Two rounds of adversarial and quality reviewer subagents.
distinct()is gone.Declined review findings
page_size=2048makes 21 filer requests. Kept: each request is small, and the default of 256 makes 3. The docs name the batch size.Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Limit task listing to page-relevant filer jobs while preserving compatibility with older taskmasters.
Bug Fixes:
Enhancements:
Documentation:
Tests: