Skip to content

Commit 4c72959

Browse files
committed
Make sure we compress rounds even in fallback sync
1 parent 1e91db0 commit 4c72959

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

aws/docker_and_sync.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,33 @@ cleanup() {
2020
echo "═══════════════════════════════════════════════════════════════════════════════"
2121
local exit_code=$?
2222
if [ -n "$(ls -A logs/ 2>/dev/null)" ]; then
23+
echo "Compressing rounds..."
24+
# Tar.gz all subfolders of any 'rounds' directory if we haven't done so.
25+
python3 - <<'PY' || true
26+
import subprocess
27+
from pathlib import Path
28+
29+
logs_dir = Path('logs')
30+
if not logs_dir.exists():
31+
raise SystemExit(0)
32+
33+
for rounds_dir in logs_dir.rglob('rounds'):
34+
if not rounds_dir.is_dir():
35+
continue
36+
for sub in rounds_dir.iterdir():
37+
if not sub.is_dir():
38+
continue
39+
tar_path = Path(str(sub) + '.tar.gz')
40+
if tar_path.exists():
41+
continue
42+
try:
43+
subprocess.run(
44+
['tar', '-czf', str(tar_path), '-C', str(sub.parent), sub.name],
45+
check=False,
46+
)
47+
except Exception:
48+
pass
49+
PY
2350
echo "Syncing codeclash logs to S3..."
2451
aws s3 sync logs/ s3://codeclash/logs/ || echo "Warning: Failed to sync logs to S3"
2552
else

0 commit comments

Comments
 (0)