1- import getpass
21import os
32import time
43import traceback
54from pathlib import Path
65
7- from codeclash .constants import DIR_LOGS
86from codeclash .utils .environment import create_file_in_container
97from codeclash .utils .log import get_logger
108
119
1210class AbstractTournament :
13- def __init__ (self , config : dict , * , name : str , output_dir : Path | None = None , ** kwargs ):
11+ def __init__ (self , config : dict , * , name : str , output_dir : Path , ** kwargs ):
1412 self .config : dict = config
1513 self .name : str = name
1614 self .tournament_id : str = f"{ self .name } .{ config ['game' ]['name' ]} .{ time .strftime ('%y%m%d%H%M%S' )} "
17- self ._custom_output_dir : Path | None = output_dir
15+ self ._output_dir : Path = output_dir
1816 self ._metadata : dict = {
1917 "name" : self .name ,
2018 "tournament_id" : self .tournament_id ,
@@ -25,15 +23,9 @@ def __init__(self, config: dict, *, name: str, output_dir: Path | None = None, *
2523
2624 @property
2725 def local_output_dir (self ) -> Path :
28- if self ._custom_output_dir is not None :
29- # Custom output directory provided, add timestamp to make it unique
30- return (self ._custom_output_dir / time .strftime ("%y%m%d%H%M%S" )).resolve ()
31-
32- # Default behavior
33- base_dir = DIR_LOGS
3426 if "PYTEST_CURRENT_TEST" in os .environ :
35- base_dir = Path ("/tmp/codeclash" )
36- return ( base_dir / getpass . getuser () / self .tournament_id ) .resolve ()
27+ return Path ("/tmp/codeclash" ) / self . _output_dir . name
28+ return self ._output_dir .resolve ()
3729
3830 def get_metadata (self ) -> dict :
3931 return self ._metadata
0 commit comments