Skip to content

Commit 19ba946

Browse files
authored
Match json_gen_strategy implementation to command_gen_strategy (#585)
1 parent 20696f4 commit 19ba946

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/cloudai/_core/test_template.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(self, system: System) -> None:
5555
"""
5656
self.system = system
5757
self._command_gen_strategy: Optional[CommandGenStrategy] = None
58-
self.json_gen_strategy: Optional[JsonGenStrategy] = None
58+
self._json_gen_strategy: Optional[JsonGenStrategy] = None
5959
self.job_id_retrieval_strategy: Optional[JobIdRetrievalStrategy] = None
6060
self.job_status_retrieval_strategy: Optional[JobStatusRetrievalStrategy] = None
6161
self.grading_strategy: Optional[GradingStrategy] = None
@@ -73,6 +73,19 @@ def command_gen_strategy(self) -> CommandGenStrategy:
7373
def command_gen_strategy(self, value: CommandGenStrategy) -> None:
7474
self._command_gen_strategy = value
7575

76+
@property
77+
def json_gen_strategy(self) -> JsonGenStrategy:
78+
if self._json_gen_strategy is None:
79+
raise ValueError(
80+
"json_gen_strategy is missing. Ensure the strategy is registered in the Registry "
81+
"by calling the appropriate registration function for the system type."
82+
)
83+
return self._json_gen_strategy
84+
85+
@json_gen_strategy.setter
86+
def json_gen_strategy(self, value: JsonGenStrategy) -> None:
87+
self._json_gen_strategy = value
88+
7689
def gen_exec_command(self, tr: TestRun) -> str:
7790
"""
7891
Generate an execution command for a test using this template.

0 commit comments

Comments
 (0)