Skip to content

Commit

Permalink
Merge pull request #206 from princeton-nlp/improvement/dont-raise-err…
Browse files Browse the repository at this point in the history
…or-on-img-removal

avoid raising error when removing non-existent image
  • Loading branch information
carlosejimenez authored Aug 17, 2024
2 parents d8586ed + f76dabf commit d9bf376
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion swebench/harness/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ def remove_image(client, image_id, logger=None):
log_error = logger.info
log_info = logger.info
raise_error = False

try:
log_info(f"Attempting to remove image {image_id}...")
client.images.remove(image_id, force=True)
log_info(f"Image {image_id} removed.")
except docker.errors.ImageNotFound:
log_info(f"Image {image_id} not found, removing has no effect.")
except Exception as e:
if raise_error:
raise e
Expand Down

0 comments on commit d9bf376

Please sign in to comment.