Bind runtime array closure to exact frozen worker inputs

This commit is contained in:
Digital Drosophila Archive
2026-09-30 21:06:22 +08:00
parent 0d3eca1c33
commit 80aeb2093d
2 changed files with 27 additions and 4 deletions
@@ -11,6 +11,7 @@ from unittest.mock import patch
import numpy as np
import normal_runner as R
import normal_prepare as P
def load_readonly(name, path):
@@ -40,6 +41,21 @@ def task(arm='paired', *, requested=True, kind='train', dan='PAM15', number=1):
class RunnerTests(unittest.TestCase):
def test_runtime_array_closure_matches_original_worker_not_directory_glob(self):
self.assertEqual(P.GRAPH_FILES,WORKER.GRAPH_FILES)
self.assertEqual(P.APL_FILES,WORKER.APL_FILES)
with tempfile.TemporaryDirectory() as folder:
root=Path(folder);graph=root/'graph';apl=root/'apl'
graph.mkdir();apl.mkdir()
# Additional reference arrays are neither consumed nor required.
for name in ('apl_out_ids.npy','input_raw.npy','output_raw.npy','pn_globals.npy'):
(apl/name).touch()
template=dict(graph_dir=str(graph),apl_bundle_dir=str(apl),coefficients_path=str(root/'coeff.json'))
paths=P.runtime_array_paths(template)
expected={str(graph/name) for name in WORKER.GRAPH_FILES} | {
str(apl/name) for name in WORKER.APL_FILES} | {template['coefficients_path']}
self.assertEqual(paths,expected);self.assertEqual(len(paths),12)
def setUp(self):
temporary=tempfile.TemporaryDirectory();self.addCleanup(temporary.cleanup)
self.root=Path(temporary.name).resolve()