Skip to content

Commit

Permalink
use delete_runs
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiedemaria committed Oct 10, 2024
1 parent 16d578b commit 79bff43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1026,8 +1026,7 @@ def update_backfill(self, partition_backfill: PartitionBackfill) -> None:
def delete_backfill(self, backfill_id: str) -> None:
check.str_param(backfill_id, "backfill_id")
runs_in_backfill = self.get_run_ids(filters=RunsFilter.for_backfill(backfill_id))
for run_id in runs_in_backfill:
self.delete_run(run_id)
self.delete_runs(runs_in_backfill)
query = db.delete(BulkActionsTable).where(BulkActionsTable.c.key == backfill_id)
with self.connect() as conn:
conn.execute(query)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1808,14 +1808,15 @@ def test_delete_backfill(self, storage: RunStorage):
backfill_timestamp=time.time(),
)
storage.add_backfill(two)
storage.add_run(
TestRunStorage.build_run(
run_id=make_new_run_id(),
job_name="some_pipeline",
status=DagsterRunStatus.SUCCESS,
tags={BACKFILL_ID_TAG: two.backfill_id},
for _ in range(3):
storage.add_run(
TestRunStorage.build_run(
run_id=make_new_run_id(),
job_name="some_pipeline",
status=DagsterRunStatus.SUCCESS,
tags={BACKFILL_ID_TAG: two.backfill_id},
)
)
)

storage.add_run(
TestRunStorage.build_run(
Expand All @@ -1831,7 +1832,7 @@ def test_delete_backfill(self, storage: RunStorage):

assert storage.get_backfill("two").backfill_id == "two"

assert len(storage.get_runs()) == 2
assert len(storage.get_runs()) == 4
storage.delete_backfill("two")
assert storage.get_backfill("two") is None
assert len(storage.get_runs()) == 1
Expand Down

0 comments on commit 79bff43

Please sign in to comment.