Skip to content

Commit

Permalink
Remove logic to rebuild based on creation date
Browse files Browse the repository at this point in the history
  • Loading branch information
john-b-yang committed Dec 10, 2024
1 parent ed3d3a5 commit 57ddbc8
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions swebench/harness/docker_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,6 @@ def get_env_configs_to_build(
try:
env_image = client.images.get(test_spec.env_image_key)
image_exists = True

if env_image.attrs["Created"] < base_image.attrs["Created"]:
# Remove the environment image if it was built after the base_image
for dep in find_dependent_images(client, test_spec.env_image_key):
# Remove instance images that depend on this environment image
remove_image(client, dep, "quiet")
remove_image(client, test_spec.env_image_key, "quiet")
image_exists = False
except docker.errors.ImageNotFound:
pass
if not image_exists:
Expand Down Expand Up @@ -454,13 +446,8 @@ def build_instance_image(
# Check if the instance image already exists
image_exists = False
try:
instance_image = client.images.get(image_name)
if instance_image.attrs["Created"] < env_image.attrs["Created"]:
# the environment image is newer than the instance image, meaning the instance image may be outdated
remove_image(client, image_name, "quiet")
image_exists = False
else:
image_exists = True
client.images.get(image_name)
image_exists = True
except docker.errors.ImageNotFound:
pass

Expand Down

0 comments on commit 57ddbc8

Please sign in to comment.