Spaces:
Paused
Paused
fix: stop redirecting stderr to logfile — HF captures stderr for logs
Browse filesThe 2>&1 redirect in background subshell was silencing stderr,
preventing HF from capturing sync daemon output. Use tee to split
output to both logfile AND stderr (for HF runtime log API).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- scripts/entrypoint.sh +4 -3
scripts/entrypoint.sh
CHANGED
|
@@ -59,7 +59,7 @@ try:
|
|
| 59 |
except:
|
| 60 |
api.create_repo(repo_id=repo, repo_type='dataset', private=True)
|
| 61 |
print(f'[entrypoint] Created dataset: {repo}', flush=True)
|
| 62 |
-
" >
|
| 63 |
else
|
| 64 |
log "[entrypoint] WARNING: persistence disabled (no token/repo)"
|
| 65 |
fi
|
|
@@ -74,11 +74,12 @@ log "[entrypoint] Wrote /etc/huggingrun.env"
|
|
| 74 |
|
| 75 |
# Background: init (download + restore) then start sync-loop
|
| 76 |
# This runs AFTER services start so HF doesn't timeout
|
|
|
|
| 77 |
(
|
| 78 |
log "[entrypoint:bg] Starting init in background ..."
|
| 79 |
-
python3 -u /opt/git_sync_daemon.py init >
|
| 80 |
log "[entrypoint:bg] Init done, starting sync-loop ..."
|
| 81 |
-
|
| 82 |
) &
|
| 83 |
BG_PID=$!
|
| 84 |
log "[entrypoint] Background init+sync PID=${BG_PID}"
|
|
|
|
| 59 |
except:
|
| 60 |
api.create_repo(repo_id=repo, repo_type='dataset', private=True)
|
| 61 |
print(f'[entrypoint] Created dataset: {repo}', flush=True)
|
| 62 |
+
" 2>&1 | tee -a "$LOGFILE" >&2 || log "[entrypoint] WARNING: Could not verify dataset"
|
| 63 |
else
|
| 64 |
log "[entrypoint] WARNING: persistence disabled (no token/repo)"
|
| 65 |
fi
|
|
|
|
| 74 |
|
| 75 |
# Background: init (download + restore) then start sync-loop
|
| 76 |
# This runs AFTER services start so HF doesn't timeout
|
| 77 |
+
# IMPORTANT: do NOT redirect stderr (2>&1) — HF captures stderr for runtime logs
|
| 78 |
(
|
| 79 |
log "[entrypoint:bg] Starting init in background ..."
|
| 80 |
+
python3 -u /opt/git_sync_daemon.py init 2>&1 | tee -a "$LOGFILE" >&2
|
| 81 |
log "[entrypoint:bg] Init done, starting sync-loop ..."
|
| 82 |
+
python3 -u /opt/git_sync_daemon.py sync-loop 2>&1 | tee -a "$LOGFILE" >&2
|
| 83 |
) &
|
| 84 |
BG_PID=$!
|
| 85 |
log "[entrypoint] Background init+sync PID=${BG_PID}"
|