pola-rs/polars · error · NotImplementedError

query monitoring is not supported by the GPU engine

Error message

query monitoring is not supported by the GPU engine

What it means

The GPU engine (a GPUEngine instance) does not implement Polars' query monitoring feature, so constructing one with `monitoring=True` fails fast with NotImplementedError. The parameter exists on the shared Engine base class but is explicitly rejected here rather than silently ignored.

Solutions

  1. Set monitoring=False (or omit it) when constructing GPUEngine.
  2. If monitoring is required, collect with the in-memory or streaming engine instead of the GPU engine.
  3. If the boolean comes from shared config, gate it: only pass monitoring to non-GPU engines.

Example fix

// before
engine = GPUEngine(monitoring=True)
lf.collect(engine=engine)

// after
engine = GPUEngine()  # monitoring not supported by GPU engine
lf.collect(engine=engine)
Defensive patterns

Strategy: validation

Validate before calling

if isinstance(engine, GPUEngine) and getattr(engine, 'monitoring', False):
    raise ValueError('monitoring is not supported by the GPU engine')

Type guard

def monitoring_safe(engine: object) -> bool:
    return not (isinstance(engine, GPUEngine) and getattr(engine, 'monitoring', False))

Prevention

When it happens

Trigger: Calling GPUEngine(monitoring=True), e.g. LazyFrame.collect(engine=GPUEngine(monitoring=True)) or sink_* with an engine that enables monitoring.

Common situations: Developers enabling query monitoring uniformly across engines via a shared config helper, or after switching from in-memory/gpu to check progress, unaware the GPU path lacks the hook.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/295fb9f930223c4d. Report an issue: GitHub.

Appendix: source

Thrown at py-polars/src/polars/lazyframe/engine.py:785

    back to the CPU engine.
    """
    config: Mapping[str, Any]
    """Additional configuration options for the engine."""

    def __init__(
        self,
        *,
        device: int | None = None,
        memory_resource: Any | None = None,
        raise_on_fail: bool = False,
        monitoring: bool = False,
        **kwargs: Any,
    ) -> None:
        # We do want a named param for `monitoring`, because otherwise it will silently
        # end up in `kwargs`
        if monitoring:
            msg = "query monitoring is not supported by the GPU engine"
            raise NotImplementedError(msg)
        super().__init__(monitoring=False)

        self.device = device
        self.memory_resource = memory_resource
        # Avoids need for changes in cudf-polars
        kwargs["raise_on_fail"] = raise_on_fail
        self.config = kwargs

    def _post_opt_callback(
        self, *, background: bool, eager: bool
    ) -> Callable[[Any, int | None], None] | None:
        if background:
            issue_warning(
                "GPU engine does not support background collection, disabling GPU engine.",
                category=UserWarning,
            )
            return None
        if eager:

View on GitHub (pinned to fe841f959e)