Your Python logs do not appear in `docker logs` or `kubectl logs` until the container exits.
BeginnerTroubleshootingConcurrency, async, tests, services & containers
Answer
Likely causes → stdout is block-buffered when not attached to a TTY, so output sits in a buffer.
Diagnose → Logs appear in bursts or only at exit.
Fix → Set ENV PYTHONUNBUFFERED=1 in the Dockerfile (or run python -u), and use logging to stderr (unbuffered by default).
Prevent → Include PYTHONUNBUFFERED=1 in every Python base image.
More on Concurrency, async, tests, services & containers
`RuntimeError: asyncio.run() cannot be called from a running event loop` in a Jupyter notebook or inside an async framework.Intermediate`RuntimeWarning: coroutine 'fetch' was never awaited` and nothing happens.BeginnerAn asyncio health-checker is no faster than a sequential loop.Advanced`Task was destroyed but it is pending!` at shutdown.Advanced`OSError: [Errno 24] Too many open files` from an asyncio scanner with 20,000 targets.IntermediateA `ThreadPoolExecutor` job finishes "successfully" but half the work is missing, with no errors logged.Intermediate