@@ -83,20 +83,23 @@ def run_training_round(self, round_num: int) -> None:
8383 self .logger .info (f"Round { round_num } :\n { record .stats } " )
8484
8585 # Create directory for round logs
86- (self .game .log_local / f"round_ { round_num } " ).mkdir (parents = True , exist_ok = True )
86+ (self .game .log_local / "rounds" / str ( round_num ) ).mkdir (parents = True , exist_ok = True )
8787
88- # Write log to file
88+ # Write logs to file
8989 for idx , lo in enumerate (record .data .logs ):
90- round_log_path = self .game .log_local / f"round_ { round_num } " / f"sim_{ idx } .log"
90+ round_log_path = self .game .log_local / "rounds" / str ( round_num ) / f"sim_{ idx } .log"
9191 round_log_path .write_text (lo )
92+ results_file = self .game .log_local / "rounds" / str (round_num ) / "results.json"
93+ with open (results_file , "w" ) as f :
94+ json .dump (record .stats .model_dump (), fp = f , indent = 2 )
9295
9396 # Copy log to agent environments
9497 for agent in self .agents :
9598 self .logger .info (f"Copying round { round_num } log(s) to { agent .name } 's container..." )
9699 copy_to_container (
97100 agent .environment ,
98- self .game .log_local / f"round_ { round_num } " ,
99- f"logs/round_ { round_num } /" ,
101+ self .game .log_local / "rounds" / str ( round_num ) ,
102+ f"logs/rounds/ { round_num } /" ,
100103 )
101104
102105 for agent in self .agents :
@@ -112,7 +115,8 @@ def run_agent(self, agent: Player, round_num: int) -> None:
112115
113116 def end (self ) -> None :
114117 """Save output files, clean up game resources and push agents if requested."""
115- (self .local_output_dir / "metadata.json" ).write_text (json .dumps (self .game .get_metadata ()))
118+ with open (self .local_output_dir / "metadata.json" , "w" ) as f :
119+ json .dump (self .game .get_metadata (), fp = f , indent = 2 )
116120 self .game .end (self .cleanup_on_end )
117121 if self .push_agent :
118122 for agent in self .agents :
0 commit comments