Reporting

The divi.reporting module provides comprehensive logging, progress reporting, and visualization functionality for quantum program execution.

Logging System

enable_logging(level=20)[source]

Enable logging for the divi package with custom formatting.

Sets up a custom logger with an OverwriteStreamHandler that supports message overwriting (for progress updates) and removes the ‘._reporter’ suffix from logger names.

Parameters:

level (int, optional) – Logging level to set (e.g., logging.INFO, logging.DEBUG). Defaults to logging.INFO.

Note

This function clears any existing handlers and sets up a new handler with custom formatting.

disable_logging()[source]

Disable all logging for the divi package.

Removes all handlers and sets the logging level to above CRITICAL, effectively suppressing all log messages. This is useful when using progress bars that provide visual feedback.

Global Logging Configuration

Configures logging for the entire Divi package with appropriate levels and formatters:

Usage:

from divi.reporting import enable_logging, disable_logging

# Enable logging (called automatically on import)
enable_logging()

# Disable logging if needed
disable_logging()

Advanced Features

Warning

Developer-Facing Features: The progress bar and progress reporting systems are intended for advanced users and developers who need custom logging and progress reporting. Most users will not need to interact with these features directly.

Progress Bar System

Rich Progress Bar Creation

The make_progress_bar function creates a customized Rich progress bar specifically designed for quantum program execution tracking:

make_progress_bar(is_jupyter=False)[source]

Create a customized Rich progress bar for tracking quantum program execution.

Builds a progress bar with custom columns including job name, completion status, elapsed time, spinner, and phase status indicators. Automatically adapts refresh behavior for Jupyter notebook environments.

Parameters:

is_jupyter (bool, optional) – Whether the progress bar is being displayed in a Jupyter notebook environment. Affects refresh behavior. Defaults to False.

Returns:

A configured Rich Progress instance with custom columns for

quantum program tracking.

Return type:

Progress

Features:

  • Custom Columns: Job name, progress bar, completion status, elapsed time

  • Spinner Animation: Conditional spinner that stops when job completes

  • Status Indicators: Visual status with emojis (Success ✅, Failed ❌, etc.)

  • Jupyter Support: Automatically adapts refresh behavior for notebook environments

  • Job Polling: Shows polling attempts and job status for service-based backends

Progress Reporting System

Divi includes a sophisticated progress reporting system that provides real-time feedback during long-running quantum computations. The system supports both console logging and queue-based progress updates for integration with external monitoring systems.

Logging Progress Reporter

Console-based progress reporter that provides formatted output during quantum program execution:

class LoggingProgressReporter[source]

Bases: ProgressReporter

Reports progress by logging messages to the console.

CYAN = '\x1b[36m'
RESET = '\x1b[0m'
update(**kwargs)[source]

Provides a progress update.

info(message, **kwargs)[source]

Provides a simple informational message. No changes to progress or state.

Queue Progress Reporter

Thread-safe progress reporter that sends updates through a queue for external monitoring:

class QueueProgressReporter(job_id, progress_queue)[source]

Bases: ProgressReporter

Reports progress by putting structured dictionaries onto a Queue.

__init__(job_id, progress_queue)[source]
update(**kwargs)[source]

Provides a progress update.

info(message, **kwargs)[source]

Provides a simple informational message. No changes to progress or state.