harbor run -t openthoughts/tasktrove-mix-h5-skill-diverse-v2-mix-h5-skill-diverse-0051harbor download openthoughts/tasktrove-mix-h5-skill-diverse-v2-mix-h5-skill-diverse-0051Implement a multi-process test runner module at /app/multi_process_runner.py that provides the functionality exercised by the given pytest test file.
Your implementation should provide the following public API (names and signatures must match):
class MultiProcessRunner
init(self, proc_func, cluster_spec, args=(), kwargs=None, list_stdout=False, max_run_time=None)
start(self)
start_single_process(self, task_type, task_id)
start_in_process_as(self, as_task_type, as_task_id)
terminate(self, task_type, task_id)
terminate_all(self)
start() / start_single_process / start_in_process_as etc. may be called in any reasonable order; the runner should manage processes already started and avoid starting duplicates.
join(self, timeout=None)
function run(proc_func, cluster_spec, args=(), kwargs=None, list_stdout=False, timeout=None)
function barrier()
class SubprocessTimeoutError(Exception)
Behavioral and interface expectations (derived from tests):
TF_CONFIG: For each subprocess (and for start_in_process_as), set an environment variable TF_CONFIG that contains JSON with at least:
Capturing stdout/stderr:
Return values and exceptions:
start_in_process_as:
start_single_process:
Barrier usage:
Implementation hints and constraints:
Do not modify the tests. Implement the above API and behavior so that the tests can start multiple task processes, capture their logs and returns, handle termination/timeouts, and provide a working barrier synchronization inside subprocesses.