Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Fixed

- **Two `docker-*` cells of one task in one process no longer share a
container name** — the name `dokimi-run-<task>-<pid>` gets a random suffix,
so one cell's cleanup cannot remove the other's container.
2 changes: 1 addition & 1 deletion dokimi/dokimi/harnesses/docker_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def run(
log = log_path.open("w", encoding="utf-8")
usage: Optional[UsageRecord] = None
image = f"dokimi/{task.name}:latest"
container = f"dokimi-run-{task.name}-{os.getpid()}"
container = f"dokimi-run-{task.name}-{os.getpid()}-{os.urandom(3).hex()}" # two cells in one process
solve_timeout = timeout_sec or task.timeout_sec or _DEFAULT_SOLVE_TIMEOUT
start = time.time()
returncode = 0
Expand Down
27 changes: 27 additions & 0 deletions dokimi/tests/test_run_container_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (C) 2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

"""The docker-* task container's name is unique per cell, not per process."""

from __future__ import annotations

from dokimi.harnesses import load_task
from dokimi.harnesses.registry import create_harness
from docker_cli_fake import DockerCLI


def test_two_runs_of_one_task_in_one_process_get_their_own_container(tmp_path):
# A suite runs every harness cell in one process: a pid-only name made the
# second cell's `docker rm -f` remove the first cell's container.
task_dir = tmp_path / "t"
for d in ("tests", "environment", "solution"):
(task_dir / d).mkdir(parents=True)
(task_dir / "instruction.md").write_text("x", encoding="utf-8")
(task_dir / "task.toml").write_text("[metadata]\ntags = []\n", encoding="utf-8")
task = load_task(task_dir)
names = set()
for arm in ("a", "b"):
cli = DockerCLI()
create_harness("docker-oracle", runner=cli).run(task, output_dir=tmp_path / arm)
names |= {a[a.index("--name") + 1] for a in cli.args if a[0] == "run"}
assert len(names) == 2 and all(n.startswith(f"dokimi-run-{task.name}-") for n in names)
Loading