Background Buffering
ML-Dash writes are non-blocking. Logs, metrics, tracks, and files are queued and flushed from a background daemon thread so the hot path stays fast.
Flush Triggers
Buffered data flushes when any of these occur:
- Time-based: every
flush_intervalseconds (default5.0). - Size-based: when a queue reaches its batch size (default
100items per queue). - Manual:
experiment.flush()blocks until queues drain. - Context exit: leaving the
Experiment(...).runcontext waits for a full drain (no timeout).
Forcing a Flush
Call flush() before any action that depends on uploads being durable (checkpoint markers, downstream readers, etc.):
Configuration
Environment Variables
Programmatic
Pass BufferConfig(buffer_enabled=False) to make every write synchronous. Useful only for debugging.
Context Exit
On __exit__, the buffer manager drains all queues before returning. Expect a short pause and console output like:
Upload failures are logged as warnings, not raised, so a flaky network won't crash training. Authentication errors usually mean re-running ml-dash login.
File Uploads
When you call save_image, save_json, etc., content is written to a temp file, queued, uploaded by one of file_upload_workers threads, then the temp file is removed. Cleanup runs even if the upload is delayed.
Thread Safety
Queues are thread-safe; logging from multiple worker threads against the same Experiment is supported.
For end-to-end examples, see Complete Examples.