@@ -85,23 +85,65 @@ def _chunked_step(constraint: str) -> Any:
8585
8686@pytest .mark .xfail (
8787 reason = "v1 derives chunks_parameter_name and chunks_default_task_count from adaptive "
88- "detection, so both are None for a statically chunked space. v0 reports them for any "
89- "chunked space. See openjd-model step_param_space.rs: chunks_param_name and "
88+ "detection, so both are None for any non-adaptive chunked space. v0 reports them for "
89+ "any chunked space. See openjd-model step_param_space.rs: chunks_param_name and "
9090 "adaptive_chunk_size are both built from adaptive_info." ,
9191 strict = True ,
9292)
93- def test_chunk_metadata_is_reported_for_a_static_space () -> None :
94- """v0 returns ``"Frame"`` and ``5`` for this space. v1 returns ``None`` for both.
95-
96- Neither value is unknowable — both are in the template — so a consumer inspecting a
97- static chunked space through v1 cannot learn which parameter chunks, or at what size.
93+ @pytest .mark .parametrize (
94+ "chunks,override,expected_count" ,
95+ [
96+ # Statically chunked: no override involved, v0 reports the template's size.
97+ ({"defaultTaskCount" : 5 , "rangeConstraint" : "CONTIGUOUS" }, None , 5 ),
98+ # Statically chunked, re-chunked by the override.
99+ ({"defaultTaskCount" : 5 , "rangeConstraint" : "CONTIGUOUS" }, 1 , 1 ),
100+ # Adaptive, turned static by the override. v0 reports the override as the size.
101+ (
102+ {"defaultTaskCount" : 5 , "targetRuntimeSeconds" : 60 , "rangeConstraint" : "CONTIGUOUS" },
103+ 1 ,
104+ 1 ,
105+ ),
106+ ],
107+ ids = ["static" , "static-overridden" , "adaptive-overridden" ],
108+ )
109+ def test_chunk_metadata_is_reported_for_a_non_adaptive_space (
110+ chunks : dict , override : int | None , expected_count : int
111+ ) -> None :
112+ """v0 returns ``"Frame"`` and the chunk size for each of these. v1 returns ``None``.
113+
114+ Neither value is unknowable — both are in the template, or are the override the caller
115+ just passed — so a consumer inspecting a non-adaptive chunked space through v1 cannot
116+ learn which parameter chunks, or at what size. One root cause, three ways to reach it:
117+ anything that leaves the space non-adaptive drops both getters.
98118 """
119+ from openjd .model ._v1 import create_job , decode_job_template
99120 from openjd .model ._v1 .job import StepParameterSpaceIterator
100121
101- it = StepParameterSpaceIterator (step = _chunked_step ("CONTIGUOUS" ))
122+ template = {
123+ "specificationVersion" : "jobtemplate-2023-09" ,
124+ "name" : "T" ,
125+ "extensions" : ["TASK_CHUNKING" ],
126+ "steps" : [
127+ {
128+ "name" : "S" ,
129+ "parameterSpace" : {
130+ "taskParameterDefinitions" : [
131+ {"name" : "Frame" , "type" : "CHUNK[INT]" , "range" : "1-10" , "chunks" : chunks }
132+ ]
133+ },
134+ "script" : {
135+ "actions" : {"onRun" : {"command" : "echo" , "args" : ["{{Task.Param.Frame}}" ]}}
136+ },
137+ }
138+ ],
139+ }
140+ job_template = decode_job_template (template = template , supported_extensions = ["TASK_CHUNKING" ])
141+ step = create_job (job_template = job_template , job_parameter_values = {}).steps [0 ]
142+
143+ it = StepParameterSpaceIterator (step = step , chunks_task_count_override = override )
102144 assert it .chunks_adaptive is False
103145 assert it .chunks_parameter_name == "Frame"
104- assert it .chunks_default_task_count == 5
146+ assert it .chunks_default_task_count == expected_count
105147
106148
107149@pytest .mark .xfail (
0 commit comments