Skip to main content
WandbTraceProcessor implements the TraceProcessor ABC and streams QitOS run data to a Weights & Biases project. Once attached, it automatically logs per-span metrics during the run and writes a final summary when the trace ends.

Installation

This installs the wandb SDK as an optional dependency. Without it, importing WandbTraceProcessor raises an ImportError.

Quick start

When the run starts, WandbTraceProcessor calls wandb.init() with the provided arguments. When the trace ends (either normally or on error), it writes a summary and calls wandb.finish() by default.

Constructor parameters


What gets logged

Per-span metrics

The processor intercepts span-end events and logs metrics incrementally during the run. Each wandb.log() call increments an internal step counter so that the W&B time-series charts align with the agent’s progression through the run.

Final summary

When the trace ends, the processor writes aggregate metrics to run.summary:

Combining with other processors

add_trace_processor appends to the global processor list, so you can combine WandbTraceProcessor with any other TraceProcessor (for example, the default LegacyTraceWriterProcessor that writes to disk):
To replace all processors (removing the default writer), use set_trace_processors:

Using with presets for config

Family presets provide recommended model parameters. Use them to populate the W&B config dictionary so that your W&B dashboard reflects the same settings the agent used:

Lifecycle control

auto_finish

By default, auto_finish=True and the processor calls wandb.finish() automatically when on_trace_end fires. Set auto_finish=False if you want to continue logging custom metrics to the same W&B run after the QitOS trace ends:

shutdown()

Call shutdown() to close the W&B run early (for example, on SIGTERM or in a notebook cleanup step):
This calls wandb.finish() if a run is active and auto_finish is True. It is safe to call multiple times.

force_flush()

Call force_flush() to ensure all buffered metrics are written to the W&B backend:
This logs an empty record at the current step counter, which triggers a flush of the W&B internal buffer.