Skip to content

Commit

Permalink
Release 2.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
john-b-yang committed Nov 24, 2024
1 parent 61d9158 commit 7501f09
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion swebench/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.1.5"
__version__ = "2.1.6"

from swebench.collect.build_dataset import main as build_dataset
from swebench.collect.get_tasks_pipeline import main as get_tasks_pipeline
Expand Down
11 changes: 11 additions & 0 deletions swebench/harness/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,12 +958,23 @@ class TestStatus(Enum):
"pydata/xarray": ["ci/requirements/environment.yml", "environment.yml"],
}


# Constants - Evaluation Keys
KEY_INSTANCE_ID = "instance_id"
KEY_MODEL = "model_name_or_path"
KEY_PREDICTION = "model_patch"


# Constants - Harness
DOCKER_PATCH = "/tmp/patch.diff"
DOCKER_USER = "root"
DOCKER_WORKDIR = "/testbed"
LOG_REPORT = "report.json"
LOG_INSTANCE = "run_instance.log"
LOG_TEST_OUTPUT = "test_output.txt"
UTF8 = "utf-8"


# Constants - Logging
APPLY_PATCH_FAIL = ">>>>> Patch Apply Failed"
APPLY_PATCH_PASS = ">>>>> Applied Patch"
Expand Down
3 changes: 2 additions & 1 deletion swebench/harness/docker_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pathlib import Path

from swebench.harness.constants import (
DOCKER_USER,
BASE_IMAGE_BUILD_DIR,
ENV_IMAGE_BUILD_DIR,
INSTANCE_IMAGE_BUILD_DIR,
Expand Down Expand Up @@ -511,7 +512,7 @@ def build_container(
try:
# Get configurations for how container should be created
config = MAP_REPO_VERSION_TO_SPECS[test_spec.repo][test_spec.version]
user = "root" if not config.get("execute_test_as_nonroot", False) else "nonroot"
user = DOCKER_USER if not config.get("execute_test_as_nonroot", False) else "nonroot"
nano_cpus = config.get("nano_cpus")

# Create the container
Expand Down
15 changes: 7 additions & 8 deletions swebench/harness/run_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@
from swebench.harness.constants import (
APPLY_PATCH_FAIL,
APPLY_PATCH_PASS,
DOCKER_PATCH,
DOCKER_USER,
DOCKER_WORKDIR,
INSTANCE_IMAGE_BUILD_DIR,
KEY_INSTANCE_ID,
KEY_MODEL,
KEY_PREDICTION,
LOG_REPORT,
LOG_INSTANCE,
LOG_TEST_OUTPUT,
RUN_EVALUATION_LOG_DIR,
UTF8,
)
from swebench.harness.docker_utils import (
remove_image,
Expand All @@ -39,14 +46,6 @@
from swebench.harness.test_spec import make_test_spec, TestSpec
from swebench.harness.utils import load_swebench_dataset, str2bool

DOCKER_PATCH = "/tmp/patch.diff"
DOCKER_USER = "root"
DOCKER_WORKDIR = "/testbed"
LOG_REPORT = "report.json"
LOG_INSTANCE = "run_instance.log"
LOG_TEST_OUTPUT = "test_output.txt"
UTF8 = "utf-8"


class EvaluationError(Exception):
def __init__(self, instance_id, message, logger):
Expand Down
3 changes: 2 additions & 1 deletion swebench/harness/test_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
MAP_REPO_TO_INSTALL,
MAP_REPO_VERSION_TO_SPECS,
USE_X86,
UTF8,
)
from swebench.harness.dockerfiles import (
get_dockerfile_base,
Expand Down Expand Up @@ -72,7 +73,7 @@ def env_image_key(self):
Note that old images are not automatically deleted, so consider cleaning up old images periodically.
"""
hash_object = hashlib.sha256()
hash_object.update(str(self.env_script_list).encode("utf-8"))
hash_object.update(str(self.env_script_list).encode(UTF8))
hash_value = hash_object.hexdigest()
val = hash_value[:22] # 22 characters is still very likely to be unique
return f"sweb.env.{self.arch}.{val}:latest"
Expand Down

0 comments on commit 7501f09

Please sign in to comment.