1
Fork 0

feat(hpc): include git hash in run_name for traceability

This commit is contained in:
Tibo De Peuter 2026-04-04 19:02:06 +02:00
parent bd06feea5f
commit 0aeff0f2da

View file

@ -1,4 +1,5 @@
import random
import subprocess
import sys
import time
from dataclasses import asdict
@ -43,7 +44,14 @@ def train(args: PPOArgs):
args.batch_size = args.num_envs * args.num_steps
args.minibatch_size = args.batch_size // args.num_minibatches
args.num_iterations = args.total_timesteps // args.batch_size
run_name = f"{args.exp_name}__seed_{args.seed}__{int(time.time())}"
# Try to get git short hash
try:
git_hash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).decode("ascii").strip()
except Exception:
git_hash = "none"
run_name = f"{args.exp_name}__seed_{args.seed}__{git_hash}__{int(time.time())}"
print(f"running name: {run_name}")
if args.run_dir is None: