Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
klieret committed Oct 7, 2024
1 parent 88b9348 commit 53d209d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
13 changes: 8 additions & 5 deletions swebench/harness/docker_build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from __future__ import annotations

import logging
import re
import traceback
import docker
import docker.errors
from tqdm import tqdm
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
Expand Down Expand Up @@ -315,8 +318,8 @@ def build_env_images(
traceback.print_exc()
failed.append(futures[future])
continue
except Exception as e:
print(f"Error building image")
except Exception:
print("Error building image")
traceback.print_exc()
failed.append(futures[future])
continue
Expand Down Expand Up @@ -390,8 +393,8 @@ def build_instance_images(
traceback.print_exc()
failed.append(futures[future])
continue
except Exception as e:
print(f"Error building image")
except Exception:
print("Error building image")
traceback.print_exc()
failed.append(futures[future])
continue
Expand All @@ -409,7 +412,7 @@ def build_instance_images(
def build_instance_image(
test_spec: TestSpec,
client: docker.DockerClient,
logger: logging.Logger,
logger: logging.Logger|None,
nocache: bool,
):
"""
Expand Down
3 changes: 2 additions & 1 deletion swebench/harness/docker_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import docker
import docker.errors
import os
import signal
import tarfile
Expand Down Expand Up @@ -284,7 +285,7 @@ def clean_images(
"""
images = list_images(client)
removed = 0
print(f"Cleaning cached images...")
print("Cleaning cached images...")
for image_name in images:
if should_remove(image_name, cache_level, clean, prior_images):
try:
Expand Down
10 changes: 5 additions & 5 deletions swebench/harness/test_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ def make_repo_script_list(specs, repo, repo_directory, base_commit, env_name):
f"cd {repo_directory}",
f"git reset --hard {base_commit}",
# Remove the remote so the agent won't see newer commits.
f"git remote remove origin",
"git remote remove origin",
# Make sure conda is available for later use
"source /opt/miniconda3/bin/activate",
f"conda activate {env_name}",
f'echo "Current environment: $CONDA_DEFAULT_ENV"',
'echo "Current environment: $CONDA_DEFAULT_ENV"',
]
if repo in MAP_REPO_TO_INSTALL:
setup_commands.append(MAP_REPO_TO_INSTALL[repo])
Expand Down Expand Up @@ -254,7 +254,7 @@ def make_eval_script_list(instance, specs, env_name, repo_directory, base_commit
]
)
eval_commands = [
f"source /opt/miniconda3/bin/activate",
"source /opt/miniconda3/bin/activate",
f"conda activate {env_name}",
f"cd {repo_directory}",
]
Expand All @@ -264,8 +264,8 @@ def make_eval_script_list(instance, specs, env_name, repo_directory, base_commit
f"git config --global --add safe.directory {repo_directory}", # for nonroot user
f"cd {repo_directory}",
# This is just informational, so we have a record
f"git status",
f"git show",
"git status",
"git show",
f"git diff {base_commit}",
"source /opt/miniconda3/bin/activate",
f"conda activate {env_name}",
Expand Down

0 comments on commit 53d209d

Please sign in to comment.