requestor: lookout and lookout ingester changes - #5065
Conversation
|
|
Tick the box to add this pull request to the merge queue (same as
|
Greptile SummaryThis PR extends Lookout requestor attribution across ingestion, persistence, schema, and query models.
Confidence Score: 4/5The PR is not yet safe to merge because batch conflation can still misattribute requestors and attach cancellation metadata to a non-cancelled terminal job. The current conflation code continues to overwrite first-write-wins cancellation and preemption actors with later batch values, while cancellation metadata is still merged after a terminal state blocks the corresponding cancellation transition. Files Needing Attention: internal/lookoutingester/lookoutdb/insertion.go
|
| Filename | Overview |
|---|---|
| internal/lookoutingester/lookoutdb/insertion.go | Adds requestor persistence and terminal-job handling, but both previously reported conflation defects remain at current HEAD. |
| internal/lookoutingester/instructions/instructions.go | Extracts cancellation, preemption, and reprioritization requestors into job update instructions. |
| internal/lookout/schema/migrations/036_add_preempt_and_reprioritize_users.sql | Adds nullable preemption and reprioritization requestor columns to the Lookout job table. |
| internal/lookout/repository/getjobs.go | Reads the new requestor columns and maps them into Lookout job models. |
| internal/server/queryapi/database/models.go | Extends query API database models with requestor attribution fields. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
E[Armada lifecycle event] --> C[Lookout instruction conversion]
C --> B[Batch conflation]
B --> P[(Lookout job row)]
P --> Q[Lookout query repository]
Q --> A[API job model]
Reviews (26): Last reviewed commit: "ok" | Re-trigger Greptile
d0b1d6b to
dacaa39
Compare
7e3de0b to
bc4053c
Compare
bc4053c to
3db7653
Compare
There was a problem hiding this comment.
🟡 Not ready to approve
Root-level Node files (package.json/package-lock.json) and a couple of small maintainability issues should be resolved/clarified before merge to avoid confusing or unintended build/dependency behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR extends Armada’s Lookout/Lookout-ingester pipeline to persist and surface “actor” (requestor) information for job preemption and reprioritisation (and aligns cancellation handling), including DB schema changes, ingestion/conversion updates, repository query updates, and additional tests.
Changes:
- Add
preempt_userandreprioritize_userfields end-to-end (ingester model → DB write path → schema/migration → Lookout repository reads → API model). - Update event-to-instruction conversion to prefer trimmed requestor fields and ingest
JobPreemptionRequestedintoPreemptUser. - Adjust terminal-job filtering/conflation behavior and expand tests to preserve/store these actor fields correctly.
File summaries
| File | Description |
|---|---|
| package.json | Introduces a repo-root Node manifest (currently empty). |
| package-lock.json | Introduces a repo-root npm lockfile. |
| internal/server/queryapi/query_api_test.go | Moves per-test DB context creation inside subtests. |
| internal/server/queryapi/database/models.go | Adds PreemptUser/ReprioritizeUser fields to query API DB model. |
| internal/scheduler/scheduling/preempting_queue_scheduler.go | Formatting-only changes (trailing commas/parentheses). |
| internal/scheduler/scheduling/preempting_queue_scheduler_test.go | Formatting-only changes (trailing commas/parentheses). |
| internal/lookoutingester/model/model.go | Adds PreemptUser/ReprioritizeUser to update instructions. |
| internal/lookoutingester/lookoutdb/insertion.go | Adds new columns to job updates, preserves/filters terminal-job actor updates, and updates SQL update semantics. |
| internal/lookoutingester/lookoutdb/insertion_test.go | Adds coverage for storing/preserving new actor fields and cancellation semantics. |
| internal/lookoutingester/instructions/instructions.go | Adds requestor normalization helper and converts preemption request events into PreemptUser. |
| internal/lookoutingester/instructions/instructions_test.go | Updates/extends converter tests for requestor fields and preemption request handling. |
| internal/lookouthc/schema/target_schema.sql | Adds new columns to target schema definition. |
| internal/lookouthc/schema/schema.go | Updates shape checks and repartitioning copy to include new columns. |
| internal/lookout/swagger.yaml | No functional change (whitespace-only). |
| internal/lookout/schema/migrations/035_add_preempt_and_reprioritize_users.sql | Adds DB migration for new columns. |
| internal/lookout/repository/util.go | Updates job simulator to use Requestor and adds reprioritisation-by actor support. |
| internal/lookout/repository/tables.go | Adds table/column mappings for new fields. |
| internal/lookout/repository/querybuilder.go | Adds new columns to GetJobs query selection. |
| internal/lookout/repository/getjobs.go | Scans/maps new columns into Lookout job model. |
| internal/lookout/repository/getjobs_test.go | Adds tests validating CancelUser, PreemptUser, and ReprioritizeUser are returned. |
| internal/lookout/repository/fieldparser.go | Normalizes last-transition timestamp formatting to UTC. |
| internal/lookout/model/model.go | Adds PreemptUser/ReprioritizeUser to Lookout job model. |
| internal/lookout/conversions/convert_test.go | Updates conversion tests to include CancelUser field. |
Review details
Files not reviewed (1)
- internal/server/queryapi/database/models.go: Generated file
- Files reviewed: 20/23 changed files
- Comments generated: 4
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
128a0b0 to
ae15bc0
Compare
ae15bc0 to
d5c465d
Compare
202e48d to
4c7f8e5
Compare
d576b9b to
3af6926
Compare
3af6926 to
ca7c00a
Compare
ca7c00a to
255a142
Compare
255a142 to
96e41d6
Compare
f3bc316 to
590358f
Compare
6f98626 to
87e1528
Compare
87e1528 to
aa35385
Compare
aa35385 to
3f26812
Compare
Currently when jobs are evicted, we do small scheduling round to decide which order these jobs are evicted in - This simply determines which order preempting jobs should consider the evicted jobs for preemption However there is a bug where the allocation isn't getting updated during this scheduling round, resulting in the code falling back to tie-breaking on queue each time In effect this means evicted jobs are purely ordered by queue name, so queue A's evicted jobs are all at the front of the evicted list, then queue B's and so on An example of this bug shown below, each letter represents a job in the named A - i.e A = job in queue A Before PR - evicted order of jobs : `A A A B B B C C C` After PR - evicted order of jobs: `A B C A B C A B C` This is clearly unfair on certain queues and not the intended behaviour. This PR fixes the bug and adds a test to assert jobs get evicted back in the appropriate order --------- Signed-off-by: JamesMurkin <jamesmurkin@hotmail.com>
3f26812 to
5e1bb25
Compare
What type of PR is this?
What this PR does / why we need it
Which issue(s) this PR fixes
Fixes #
Special notes for your reviewer