Skip to content

Feat/live ingestion job summary#91

Merged
koenvo merged 7 commits into
mainfrom
feat/live-ingestion-job-summary
Jul 8, 2026
Merged

Feat/live ingestion job summary#91
koenvo merged 7 commits into
mainfrom
feat/live-ingestion-job-summary

Conversation

@koenvo

@koenvo koenvo commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

koenvo added 7 commits July 3, 2026 13:39
Previously the summary row was written exactly once, when the ingestion job
finished. For the async submit/collect flow this means a long-running job
(hours of polling) leaves no trace until completion — and no trace at all if
it never finishes (e.g. a source stuck in has_pending()).

Now the summary is persisted incrementally, for both flows:
- A RUNNING row is written up front, right after the summary is created, so
  the job is observable from the start and a record survives even if the run
  never reaches its final yield.
- A throttled progress snapshot (parent row only, ~every
  PROGRESS_SAVE_INTERVAL=100 tasks) is written after each sync batch and each
  async collect, keeping counters/state current mid-run.
- The final write is unchanged (FINISHED + failed task summaries).

Mechanics:
- IngestionJobSummary.recount(): non-destructive counter recompute, reused by
  _set_ended() (which still truncates to failed tasks on end). duration now
  tolerates ended_at=None for live snapshots.
- save_ingestion_job_summary(..., include_task_summaries=False): parent-only
  upsert so repeated live writes don't re-upsert the growing child rows. The
  upsert is keyed on ingestion_job_summary_id, so live writes update in place.

Tests: test_live_job_summary covers both the sync find_datasets flow and the
async submit/collect flow (RUNNING written first, live progress during the
run, FINISHED last).
Follow-up on the live IngestionJobSummary writes:

- Only FAILED task summaries are ever persisted as child rows (successful,
  ignored and skipped tasks are captured by the counters). This drops the
  include_task_summaries flag entirely: every write — live or final — persists
  the parent row plus any failed task summaries. A successful run writes no
  child rows at all, so live snapshots stay cheap, and failures now show up in
  the database as soon as they happen instead of only at the end.

- test_live_job_summary now asserts on what is actually stored in the database
  (load_ingestion_job_summaries), reading the summaries back after each write
  to prove the RUNNING row + live progress are persisted mid-run (not just that
  save was called).
…errors

StopProcessing stops a run gracefully (exit 2). FatalError is its
counterpart for unrecoverable, non-retryable problems (e.g. a deactivated
account): the source/loader raises it, ingestify propagates it out of
find_datasets/collect instead of swallowing it as a skipped find_datasets,
and the CLI exits non-zero so schedulers surface the failure.

Claude-Session: https://claude.ai/code/session_01B5EfLJqoafjW1FhvkxGSmg
…sing controlled

Two fixes on top of the FatalError work:

1. FatalError now persists the summary (as FAILED) before aborting. The loader
   has no finally to save an in-progress summary, so a bare re-raise lost the
   record entirely. It now set_exception + yields (so the loader stores it) +
   re-raises, at each point FatalError can surface.

2. The async submit/collect path had NO stop/fail handling at all: a
   StopProcessing (e.g. quota) or FatalError raised while collecting propagated
   without ever persisting the summary. Added a handler mirroring the sync path
   so StopProcessing saves a FINISHED summary (controlled stop) and FatalError a
   FAILED one.

StopProcessing keeps its own controlled-stop semantics and is no longer folded
into FatalError's re-raise clauses — only FatalError forces the hard stop.

Claude-Session: https://claude.ai/code/session_01B5EfLJqoafjW1FhvkxGSmg
@koenvo koenvo merged commit 7f02fb5 into main Jul 8, 2026
13 checks passed
@koenvo koenvo deleted the feat/live-ingestion-job-summary branch July 8, 2026 13:25
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.

1 participant