Skip to content

Commit

Permalink
[Lookout] Make pruner removed rejected jobs
Browse files Browse the repository at this point in the history
We have added a new terminal job state but we didn't update the Lookout pruner to remove jobs in this state

This leads to a build up of jobs in Rejected state

This PR addresses this by making it so we now clean up jobs in Rejected state

Signed-off-by: JamesMurkin <jamesmurkin@hotmail.com>
  • Loading branch information
JamesMurkin committed Sep 23, 2024
1 parent fc19a27 commit e2fc17c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/lookoutv2/pruner/pruner.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ func createJobIdsToDeleteTempTable(ctx *armadacontext.Context, db *pgx.Conn, cut
4, -- Succeeded
5, -- Failed
6, -- Cancelled
7 -- Preempted
7, -- Preempted
9 -- Rejected
)
)`, cutOffTime)
if err != nil {
Expand Down
8 changes: 8 additions & 0 deletions internal/lookoutv2/pruner/pruner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ func TestPruneDb(t *testing.T) {
ts: baseTime.Add(-(10*time.Hour + 1*time.Minute)),
state: lookout.JobPreempted,
},
{
jobId: sampleJobIds[4],
ts: baseTime.Add(-(10*time.Hour + 1*time.Minute)),
state: lookout.JobRejected,
},
},
jobIdsLeft: []string{},
},
Expand Down Expand Up @@ -195,6 +200,9 @@ func storeJob(job testJob, db *lookoutdb.LookoutDb, converter *instructions.Inst
simulator.
Preempted(job.ts).
Build()
case lookout.JobRejected:
simulator.
Rejected("invalid", job.ts)
case lookout.JobRunning:
simulator.
Build()
Expand Down

0 comments on commit e2fc17c

Please sign in to comment.