Skip to content

requestor: lookout and lookout ingester changes - #5065

Open
nikola-jokic wants to merge 8 commits into
nikola-jokic/requestor-armadactlfrom
nikola-jokic/requestr-lookout
Open

requestor: lookout and lookout ingester changes#5065
nikola-jokic wants to merge 8 commits into
nikola-jokic/requestor-armadactlfrom
nikola-jokic/requestr-lookout

Conversation

@nikola-jokic

Copy link
Copy Markdown
Contributor

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

@datadog-armadaproject

datadog-armadaproject Bot commented Jul 28, 2026

Copy link
Copy Markdown

Pipelines

⚠️ Warnings

🚦 3 Pipeline jobs failed

CI | All jobs succeeded

View in Datadog · View in GitHub Actions

CI | lint / Lint Go

View in Datadog · View in GitHub Actions

1 typecheck error in internal/lookoutingester/instructions/instructions_test.go:289:53: 'CancelledJob' type has no field or method 'CancelUser'

CI | test / Golang Unit Tests

View in Datadog · View in GitHub Actions

Build failed for package 'github.com/armadaproject/armada/internal/lookoutingester/instructions'.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 5e1bb25 | Docs | View more details | Give us feedback!

@mergify

mergify Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Comment thread internal/lookoutingester/lookoutdb/insertion.go
@greptile-apps

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR extends Lookout requestor attribution across ingestion, persistence, schema, and query models.

  • Adds preemption and reprioritization requestor fields to Lookout database schemas and migrations.
  • Extracts cancellation, preemption, and reprioritization actors from events and persists them with field-specific overwrite semantics.
  • Exposes the new fields through Lookout and query API models and adds ingestion/repository coverage.

Confidence Score: 4/5

The 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

Important Files Changed

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]
Loading

Reviews (26): Last reviewed commit: "ok" | Re-trigger Greptile

@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch from d0b1d6b to dacaa39 Compare July 28, 2026 21:07
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch from 7e3de0b to bc4053c Compare July 30, 2026 14:38
Comment thread internal/lookoutingester/lookoutdb/insertion.go
Copilot AI review requested due to automatic review settings August 3, 2026 08:07
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch from bc4053c to 3db7653 Compare August 3, 2026 08:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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_user and reprioritize_user fields 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 JobPreemptionRequested into PreemptUser.
  • 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.

Comment thread internal/lookoutingester/instructions/instructions.go Outdated
Comment thread internal/lookoutingester/instructions/instructions.go Outdated
Comment thread internal/lookoutingester/lookoutdb/insertion.go
Comment thread package.json Outdated
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch 2 times, most recently from 128a0b0 to ae15bc0 Compare August 3, 2026 11:48
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch from ae15bc0 to d5c465d Compare August 4, 2026 08:29
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch 3 times, most recently from 202e48d to 4c7f8e5 Compare August 7, 2026 12:04
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch 2 times, most recently from d576b9b to 3af6926 Compare August 10, 2026 13:49
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch from 3af6926 to ca7c00a Compare August 10, 2026 21:00
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch from ca7c00a to 255a142 Compare August 13, 2026 08:29
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch from 255a142 to 96e41d6 Compare August 14, 2026 07:41
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch from f3bc316 to 590358f Compare August 17, 2026 08:14
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch 3 times, most recently from 6f98626 to 87e1528 Compare August 19, 2026 10:01
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch from 87e1528 to aa35385 Compare August 19, 2026 13:56
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch from aa35385 to 3f26812 Compare August 19, 2026 15:23
JamesMurkin and others added 8 commits August 19, 2026 17:27
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>
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/requestr-lookout branch from 3f26812 to 5e1bb25 Compare August 19, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants