-
-
Notifications
You must be signed in to change notification settings - Fork 239
Delete dull job and instance models created on no capacity retry #4059
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
Open
r4victor
wants to merge
4
commits into
master
Choose a base branch
from
issue_4054_job_models_limit
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+378
−34
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
19c4a5a
Delete dull job sumbissions created on no capacity retry
r4victor 841dbb1
Target runs for non-provisioned job events
r4victor ecf4c57
Revert "Target runs for non-provisioned job events"
r4victor 63bf622
Implement within_runs filter via entity_run_id column
r4victor 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
Some comments aren't visible on the classic Files Changed page.
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
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
51 changes: 51 additions & 0 deletions
51
...er/migrations/versions/2026/07_22_1256_ad348ea93493_add_eventtargetmodel_entity_run_id.py
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,51 @@ | ||
| """Add EventTargetModel.entity_run_id | ||
|
|
||
| Revision ID: ad348ea93493 | ||
| Revises: e9c5e7e26c78 | ||
| Create Date: 2026-07-22 12:56:04.527041+00:00 | ||
|
|
||
| """ | ||
|
|
||
| import sqlalchemy as sa | ||
| import sqlalchemy_utils | ||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "ad348ea93493" | ||
| down_revision = "e9c5e7e26c78" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| with op.batch_alter_table("event_targets", schema=None) as batch_op: | ||
| batch_op.add_column( | ||
| sa.Column( | ||
| "entity_run_id", sqlalchemy_utils.types.uuid.UUIDType(binary=False), nullable=True | ||
| ) | ||
| ) | ||
| batch_op.create_index( | ||
| batch_op.f("ix_event_targets_entity_run_id"), ["entity_run_id"], unique=False | ||
| ) | ||
| batch_op.create_foreign_key( | ||
| batch_op.f("fk_event_targets_entity_run_id_runs"), | ||
| "runs", | ||
| ["entity_run_id"], | ||
| ["id"], | ||
| ondelete="CASCADE", | ||
| ) | ||
|
|
||
| # ### end Alembic commands ### | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| with op.batch_alter_table("event_targets", schema=None) as batch_op: | ||
| batch_op.drop_constraint( | ||
| batch_op.f("fk_event_targets_entity_run_id_runs"), type_="foreignkey" | ||
| ) | ||
| batch_op.drop_index(batch_op.f("ix_event_targets_entity_run_id")) | ||
| batch_op.drop_column("entity_run_id") | ||
|
|
||
| # ### end Alembic commands ### |
45 changes: 45 additions & 0 deletions
45
...grations/versions/2026/07_22_1331_87d4312605e5_backfill_eventtargetmodel_entity_run_id.py
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 @@ | ||
| """Backfill EventTargetModel.entity_run_id | ||
|
|
||
| Revision ID: 87d4312605e5 | ||
| Revises: ad348ea93493 | ||
| Create Date: 2026-07-22 13:31:47.070886+00:00 | ||
|
|
||
| """ | ||
|
|
||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "87d4312605e5" | ||
| down_revision = "ad348ea93493" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| # Events recorded before entity_run_id was introduced have it unset. | ||
| # The within_runs events filter relies on entity_run_id, so backfill it. | ||
| # Job targets are backfilled via the jobs table, so this migration must run | ||
| # before the job models the events reference are deleted | ||
| # (e.g. superseded no capacity submissions deleted on resubmission). | ||
| # Old replicas can still record events without entity_run_id while | ||
| # this migration is being deployed. Such events won't be backfilled and | ||
| # won't be returned by the within_runs events filter. | ||
| op.execute( | ||
| """ | ||
| UPDATE event_targets SET entity_run_id = entity_id | ||
| WHERE entity_type = 'run' AND entity_run_id IS NULL | ||
| """ | ||
| ) | ||
| op.execute( | ||
| """ | ||
| UPDATE event_targets SET entity_run_id = jobs.run_id | ||
| FROM jobs | ||
| WHERE jobs.id = event_targets.entity_id | ||
| AND event_targets.entity_type = 'job' | ||
| AND event_targets.entity_run_id IS NULL | ||
| """ | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| pass | ||
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.
Enums like
entity_typehold uppercase values