Skip to content

Commit

Permalink
Merge pull request #204 from 2i2c-org/eval-path
Browse files Browse the repository at this point in the history
Require specifying full path to evaluator command
  • Loading branch information
yuvipanda authored Nov 26, 2024
2 parents d61af67 + 6e37daf commit 21bb4b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion frx_challenges/frx_challenges/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@
SUBMISSIONS_RESULTS_DIR = output_dir

EVALUATOR_DOCKER_IMAGE = "quay.io/yuvipanda/evaluator-harness:latest"
EVALUATOR_DOCKER_CMD = []
# `{submission_path}` and `{result_path}` are substituted
EVALUATOR_DOCKER_CMD = ["{submission_path}", "{result_path}"]

# Set to true to disable network access from inside the container started by evaluator
EVALUATOR_DOCKER_DISABLE_NETWORK = True
Expand Down
15 changes: 10 additions & 5 deletions frx_challenges/web/management/commands/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,17 @@ async def start_evaluation(self, input_uri):
host_config["Memory"] = settings.EVALUATOR_DOCKER_CONTAINER_MEMORY_LIMIT
if settings.EVALUATOR_DOCKER_DISABLE_NETWORK:
host_config["NetworkMode"] = "none"
cmd = [
c.format(
submission_path=input_container_path,
result_path=f"{output_container_path}/output.json",
)
for c in settings.EVALUATOR_DOCKER_CMD
]
container = await self.docker.containers.create(
config={
"Image": self.image,
"Cmd": settings.EVALUATOR_DOCKER_CMD
+ [
f"{input_container_path}",
f"{output_container_path}/output.json",
],
"Cmd": cmd,
"HostConfig": host_config,
}
)
Expand All @@ -96,6 +99,8 @@ async def start_evaluation(self, input_uri):
return {
"container_id": container.id,
"results_uri": results_uri,
"command": cmd,
"image": self.image,
}

async def is_still_running(self, state: dict) -> bool:
Expand Down

0 comments on commit 21bb4b7

Please sign in to comment.