1818from abc import ABC , abstractmethod
1919from typing import Any , Dict
2020
21+ import toml
22+
2123from .system import System
2224from .test_scenario import TestRun
2325
@@ -29,6 +31,8 @@ class JsonGenStrategy(ABC):
2931 It specifies how to generate JSON job specifications based on system and test parameters.
3032 """
3133
34+ TEST_RUN_DUMP_FILE_NAME : str = "test-run.toml"
35+
3236 def __init__ (self , system : System , test_run : TestRun ) -> None :
3337 self .system = system
3438 self .test_run = test_run
@@ -54,6 +58,14 @@ def sanitize_k8s_job_name(self, job_name: str) -> str:
5458 sanitized_name = re .sub (r"[^a-z0-9]+$" , "" , sanitized_name )
5559 return sanitized_name [:253 ]
5660
61+ def store_test_run (self ) -> None :
62+ from cloudai .models .scenario import TestRunDetails
63+
64+ test_cmd , srun_cmd = ("" , "n/a" )
65+ with (self .test_run .output_path / self .TEST_RUN_DUMP_FILE_NAME ).open ("w" ) as f :
66+ trd = TestRunDetails .from_test_run (self .test_run , test_cmd = test_cmd , full_cmd = srun_cmd )
67+ toml .dump (trd .model_dump (), f )
68+
5769 @abstractmethod
5870 def gen_json (self ) -> Dict [Any , Any ]:
5971 """
0 commit comments