client.flush() or client.finish() before the worker task completes. This helps in short-lived environments like AWS Lambda, Google Cloud Run, or notebooks that exit right after execution.
These methods have different purposes, so choose the one that fits your environment:
weave.flush(): Provides silent flushing. Recommended when Weave is integrated into worker processes or continuous integration (CI) environments.weave.finish(): Provides progress feedback with a progress bar or status callbacks. Recommended for interactive scripts or notebooks.
client.finish() from a Celery task to flush traces before the worker returns. Replace [TEAM-NAME] with your W&B team name and [PROJECT-NAME] with your W&B project name:
with context manager to call weave.finish() automatically on exit:
weave.flush(). For more information, see Flushing.
For additional resilience against data loss, consider enabling the write-ahead log, which writes trace data to disk before it sends the data to the server.
Trace Data Performance