Skip to content

Commit 7313746

Browse files
committed
fix: preserve property rerun filtering
Fixes #1898 Coding-Agent: Codex Codex-Version: codex-cli 0.149.0 Model: gpt-5.6-sol Reasoning-Effort: xhigh
1 parent d5ce577 commit 7313746

2 files changed

Lines changed: 50 additions & 3 deletions

File tree

dpgen/auto_test/common_prop.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def run_property(confs, inter_param, property_list, mdata):
167167
worker,
168168
(
169169
work_path,
170-
all_task,
170+
run_tasks,
171171
forward_common_files,
172172
forward_files,
173173
backward_files,
@@ -187,14 +187,13 @@ def run_property(confs, inter_param, property_list, mdata):
187187

188188
def worker(
189189
work_path,
190-
all_task,
190+
run_tasks,
191191
forward_common_files,
192192
forward_files,
193193
backward_files,
194194
mdata,
195195
inter_type,
196196
):
197-
run_tasks = [os.path.basename(ii) for ii in all_task]
198197
machine, resources, command, group_size = util.get_machine_info(mdata, inter_type)
199198
api_version = mdata.get("api_version", "1.0")
200199
if Version(api_version) < Version("1.0"):
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import unittest
2+
from unittest.mock import MagicMock, patch
3+
4+
from dpgen.auto_test.common_prop import run_property
5+
6+
7+
class TestRunProperty(unittest.TestCase):
8+
@patch(
9+
"dpgen.auto_test.common_prop.convert_mdata", side_effect=lambda data, _: data
10+
)
11+
@patch("dpgen.auto_test.common_prop.make_calculator")
12+
@patch("dpgen.auto_test.common_prop.util.collect_task")
13+
@patch("dpgen.auto_test.common_prop.glob.glob")
14+
@patch("dpgen.auto_test.common_prop.Pool")
15+
def test_only_unfinished_tasks_are_sent_to_worker(
16+
self, pool_class, glob_files, collect_task, make_calculator, _convert_mdata
17+
):
18+
task_paths = ["/work/task.000000", "/work/task.000001"]
19+
glob_files.side_effect = lambda pattern: (
20+
task_paths if "task.[0-9]*[0-9]" in pattern else ["conf"]
21+
)
22+
collect_task.return_value = ["task.000001"]
23+
24+
calculator = MagicMock()
25+
calculator.forward_files.return_value = []
26+
calculator.forward_common_files.return_value = []
27+
calculator.backward_files.return_value = []
28+
make_calculator.return_value = calculator
29+
30+
pool = MagicMock()
31+
result = MagicMock()
32+
result.successful.return_value = True
33+
pool.apply_async.return_value = result
34+
pool_class.return_value = pool
35+
36+
run_property(
37+
["conf"],
38+
{"type": "vasp"},
39+
[{"type": "eos"}],
40+
{},
41+
)
42+
43+
worker_args = pool.apply_async.call_args.args[1]
44+
self.assertEqual(worker_args[1], ["task.000001"])
45+
46+
47+
if __name__ == "__main__":
48+
unittest.main()

0 commit comments

Comments
 (0)