reclient: Clear log dir between builds

Bug: b/287650736
Change-Id: I87c0226f428211ac99520b024edeaf5ccb6a674c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4629861
Commit-Queue: Ben Segall <bentekkie@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Auto-Submit: Ben Segall <bentekkie@google.com>
This commit is contained in:
Ben Segall
2023-06-21 14:23:37 +00:00
committed by LUCI CQ
parent 4ec095fa85
commit 2e6738447e
2 changed files with 38 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ for any reason e.g. build completion, keyboard interrupt etc."""
import contextlib
import hashlib
import os
import shutil
import subprocess
import sys
@@ -142,6 +143,9 @@ def set_reproxy_path_flags(out_dir, make_dirs=True):
log_dir = os.path.join(tmp_dir, 'logs')
cache_dir = find_cache_dir(tmp_dir)
if make_dirs:
if os.path.exists(log_dir):
# Clear log dir before each build to ensure correct metric aggregation.
shutil.rmtree(log_dir)
os.makedirs(tmp_dir, exist_ok=True)
os.makedirs(log_dir, exist_ok=True)
os.makedirs(cache_dir, exist_ok=True)