Skip to content

feat: persist per-attempt job runs - #236

Merged
ecarreras merged 1 commit into
mainfrom
feat/issue-227-job-runs
Oct 5, 2026
Merged

ecarreras merged 1 commit into
mainfrom
feat/issue-227-job-runs

Conversation

@giscebot

@giscebot giscebot commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • persist a job_runs record for every claimed attempt and close it on done, blocked, requeued, or cancelled transitions
  • make completed runs the source of truth for runtime totals and percentiles while preserving the existing job summary fields
  • assign each run to the local day with the largest elapsed overlap, using the start day for ties and deriving the month from that day
  • expose run history in job details and update the dashboard counter to report runs

Migration and retention

  • schema initialization backfills at most the last recoverable legacy interval as historical with is_estimated=1
  • historical attempts that cannot be reconstructed are not invented
  • runs follow their parent job lifecycle through ON DELETE CASCADE; they are not independently pruned so historical usage does not change silently

Tests

  • .venv/bin/pytest -q — 392 passed
  • npm test — 60 passed
  • npm run build

Closes #227

Requested by: @ecarreras

Co-authored-by: ecarreras <294235+ecarreras@users.noreply.github.com>

@pilipilisbot pilipilisbot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved. I reviewed the queue/run lifecycle changes against #227 and did not find blocking issues.

What I checked:

  • claim_next() creates a per-attempt job_runs row and keeps jobs as the compatibility summary.
  • finish(), requeue_running(), block_running(), mark_cancelled(), and unlock_stale() close the active run with the expected result.
  • Legacy schema initialization backfills only the recoverable interval and marks it estimated.
  • Runtime metrics now use completed job_runs, preserve work/review grouping, and assign cross-midnight runs by largest local-day overlap with start-day tie behavior.
  • The dashboard detail exposes run history, and packaged resource coverage includes the new table.

Validation:

  • Local focused suite: /tmp/gab-pr236-venv/bin/pytest -q tests/test_queue.py tests/test_backend.py tests/test_packaged_resources.py -> 111 passed, 1 warning.
  • Local full Python suite: /tmp/gab-pr236-venv/bin/pytest -q -> 392 passed, 1 warning.
  • GitHub checks are green for dashboard, pytest 3.11, and pytest 3.12.

I did not rerun the dashboard npm tests locally because this review worktree has no node_modules; the PR's dashboard check is green.

@ecarreras
ecarreras merged commit 290e5d8 into main Oct 5, 2026
3 checks passed
@ecarreras
ecarreras deleted the feat/issue-227-job-runs branch October 5, 2026 07:59
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.

Registrar cada run i imputar correctament el runtime per dia

3 participants