-
Notifications
You must be signed in to change notification settings - Fork 0
feat: ingest pipeline backpressure and transient failure handling #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3d1195b
feat: add database migration for deliver_after column and batches_fai…
rorybyrne 660fe3b
refactor: replace ingest run SRN with simple ID throughout system
rorybyrne ce7b625
refactor: simplify ingest completion check logic
rorybyrne 408c9bd
feat: add backpressure control and container log capture
rorybyrne 1fdca75
feat: increase MAX_PENDING_BATCHES from 1 to 4 to improve ingestion t…
rorybyrne 21ada51
feat: add max retries configuration and improve backpressure logging
rorybyrne 1d92124
refactor: replace batch count backpressure with cluster capacity check
rorybyrne f863670
fix: include tests directory in linting and formatting commands
rorybyrne ea55bb2
feat: enhance k8s job failure handling and cleanup
rorybyrne eecf195
feat: add retry exhaustion handling for batch publish failures
rorybyrne e5361d9
feat: handle OOM exhaustion in RunHooks to allow partial results
rorybyrne c759d1d
fix: only trigger backpressure on genuinely unschedulable pods
rorybyrne f690212
fix: guard on_exhausted errors and consolidate completion logic
rorybyrne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| """add_deliver_after_and_batches_failed | ||
|
|
||
| Add deliver_after column to deliveries table for explicit backoff scheduling. | ||
| Add batches_failed column to ingest_runs table for batch failure accounting. | ||
|
|
||
| Revision ID: add_deliver_after | ||
| Revises: add_ingest_runs | ||
| Create Date: 2026-04-04 | ||
|
|
||
| """ | ||
|
|
||
| from typing import Sequence, Union | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision: str = "add_deliver_after" | ||
| down_revision: Union[str, Sequence[str], None] = "add_ingest_runs" | ||
| branch_labels: Union[str, Sequence[str], None] = None | ||
| depends_on: Union[str, Sequence[str], None] = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| op.add_column( | ||
| "deliveries", | ||
| sa.Column("deliver_after", sa.DateTime(timezone=True), nullable=True), | ||
| ) | ||
| op.create_index( | ||
| "idx_deliveries_deliver_after", | ||
| "deliveries", | ||
| ["deliver_after"], | ||
| postgresql_where=sa.text("status = 'pending'"), | ||
| ) | ||
|
|
||
| op.add_column( | ||
| "ingest_runs", | ||
| sa.Column("batches_failed", sa.Integer, nullable=False, server_default=sa.text("0")), | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| op.drop_column("ingest_runs", "batches_failed") | ||
| op.drop_index("idx_deliveries_deliver_after", table_name="deliveries") | ||
| op.drop_column("deliveries", "deliver_after") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
srn→idcolumn rename not captured in the migration chainadd_ingest_runs.pywas edited in-place to rename the primary key fromsrntoidand to drop theForeignKey("conventions.srn")constraint onconvention_srn. The newadd_deliver_aftermigration only addsbatches_failedanddeliver_after— it contains noALTER TABLE ingest_runs RENAME COLUMN srn TO idorDROP CONSTRAINTstep.Any environment (CI, staging, a teammate's dev DB) that already has
add_ingest_runsapplied with the old schema will:add_deliver_aftersuccessfully (adds new columns)srncolumn instead ofid, causing every query with.where(ingest_runs_table.c.id == ...)to fail at runtimeIf the old migration has never been applied anywhere this is fine, but if it has, the upgrade needs an explicit rename step in
add_deliver_after: