MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / get_output_path

Function get_output_path

codeclash/cli/app.py:60–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

58 config = yaml.safe_load(preprocessed_yaml)
59
60 if "ladder_rules" in config:
61 raise typer.BadParameter(
62 "ladder_rules (min_round_wins, win_last_k, fast_forward, early_clinch) applies only to "
63 "`codeclash ladder run`, not `codeclash run`."
64 )
65
66 def get_output_path() -> Path:
67 if is_running_in_aws_batch():
68 # Offset timestamp by random seconds to avoid collisions
69 offset = random.randint(0, 600)
70 timestamp = time.strftime("%y%m%d%H%M%S", time.localtime(time.time() + offset))
71 else:
72 timestamp = time.strftime("%y%m%d%H%M%S")
73 rounds = config["tournament"]["rounds"]
74 transparent = config["tournament"].get("transparent", False)
75 sims = config["game"]["sims_per_round"]
76
77 players = [p["name"] for p in config["players"]]
78 p_num = len(players)
79 p_list = ".".join(sorted(players))
80 suffix_part = f".{suffix}" if suffix else ""
81 folder_name = (
82 f"PvpTournament.{config['game']['name']}.r{rounds}.s{sims}.p{p_num}.{p_list}{suffix_part}.{timestamp}"
83 )
84 if transparent:
85 folder_name += ".transparent"
86 if is_running_in_aws_batch():
87 _uuid = str(uuid.uuid4())
88 folder_name += f".{_uuid}-uuid"
89 if output_dir is None:
90 if is_running_in_aws_batch():
91 return LOCAL_LOG_DIR / "batch" / folder_name
92 else:

Callers 1

runFunction · 0.85

Calls 2

is_running_in_aws_batchFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected