Skip to content

Commit cc4855c

Browse files
committed
surpress removal warnings
1 parent 10c36f2 commit cc4855c

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

src/datasmith/agents/context_synthesis.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,25 @@
2121

2222

2323
def remove_containers_by_label(client: docker.DockerClient, run_id: str) -> None:
24-
with contextlib.suppress(NotFound):
24+
with contextlib.suppress(Exception):
2525
for c in client.containers.list(all=True, filters={"label": f"datasmith.run={run_id}"}):
2626
c.remove(force=True)
2727

2828

2929
def remove_images_by_label(client: docker.DockerClient, run_id: str) -> None:
3030
# List is cheap and does not contend. Remove by ID avoids tag races.
31-
imgs = client.images.list(filters={"label": f"datasmith.run={run_id}"})
32-
for img in imgs:
33-
try:
34-
client.images.remove(img.id, force=True, noprune=False)
35-
except (ImageNotFound, NotFound):
36-
pass
37-
except APIError as e:
38-
# 409 conflict: still in use by a live container; skip
39-
if getattr(e, "status_code", None) != 409:
40-
# Optional: log at DEBUG
31+
with contextlib.suppress(Exception):
32+
imgs = client.images.list(filters={"label": f"datasmith.run={run_id}"})
33+
for img in imgs:
34+
try:
35+
client.images.remove(img.id, force=True, noprune=False)
36+
except (ImageNotFound, NotFound):
4137
pass
38+
except APIError as e:
39+
# 409 conflict: still in use by a live container; skip
40+
if getattr(e, "status_code", None) != 409:
41+
# Optional: log at DEBUG
42+
pass
4243

4344

4445
def gen_run_labels(t: Task, runid: str) -> dict[str, str]:

0 commit comments

Comments
 (0)