MCPcopy Create free account
hub / github.com/RUC-NLPIR/WebThinker / check_correctness

Function check_correctness

scripts/lcb_runner/evaluation/utils_execute.py:64–84  ·  view source on GitHub ↗

Evaluates the functional correctness of a completion by running the test suite provided in the problem. :param completion_id: an optional completion ID so we can match the results later even if execution finishes asynchronously.

(check_program, timeout=3)

Source from the content-addressed store, hash-verified

62"""
63
64def check_correctness(check_program, timeout=3):
65 """
66 Evaluates the functional correctness of a completion by running the test
67 suite provided in the problem.
68
69 :param completion_id: an optional completion ID so we can match
70 the results later even if execution finishes asynchronously.
71 """
72 manager = multiprocessing.Manager()
73 result = manager.list()
74
75 p = multiprocessing.Process(target=unsafe_execute, args=(check_program, result, timeout))
76 p.start()
77 p.join(timeout=timeout + 1)
78 if p.is_alive():
79 p.kill()
80
81 if not result:
82 result.append("timed out")
83
84 return result[0] == "passed"
85
86
87def unsafe_execute(check_program, result, timeout):

Callers 1

evaluate_scoreFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected