{"record":{"id":"295fb9f930223c4d","repo":"pola-rs/polars","slug":"query-monitoring-is-not-supported-by-the-gpu-engin","errorCode":null,"errorMessage":"query monitoring is not supported by the GPU engine","messagePattern":"query monitoring is not supported by the GPU engine","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/lazyframe/engine.py","lineNumber":785,"sourceCode":"    back to the CPU engine.\n    \"\"\"\n    config: Mapping[str, Any]\n    \"\"\"Additional configuration options for the engine.\"\"\"\n\n    def __init__(\n        self,\n        *,\n        device: int | None = None,\n        memory_resource: Any | None = None,\n        raise_on_fail: bool = False,\n        monitoring: bool = False,\n        **kwargs: Any,\n    ) -> None:\n        # We do want a named param for `monitoring`, because otherwise it will silently\n        # end up in `kwargs`\n        if monitoring:\n            msg = \"query monitoring is not supported by the GPU engine\"\n            raise NotImplementedError(msg)\n        super().__init__(monitoring=False)\n\n        self.device = device\n        self.memory_resource = memory_resource\n        # Avoids need for changes in cudf-polars\n        kwargs[\"raise_on_fail\"] = raise_on_fail\n        self.config = kwargs\n\n    def _post_opt_callback(\n        self, *, background: bool, eager: bool\n    ) -> Callable[[Any, int | None], None] | None:\n        if background:\n            issue_warning(\n                \"GPU engine does not support background collection, disabling GPU engine.\",\n                category=UserWarning,\n            )\n            return None\n        if eager:","sourceCodeStart":767,"sourceCodeEnd":803,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/lazyframe/engine.py#L767-L803","documentation":"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.","triggerScenarios":"Calling GPUEngine(monitoring=True), e.g. LazyFrame.collect(engine=GPUEngine(monitoring=True)) or sink_* with an engine that enables monitoring.","commonSituations":"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.","solutions":["Set monitoring=False (or omit it) when constructing GPUEngine.","If monitoring is required, collect with the in-memory or streaming engine instead of the GPU engine.","If the boolean comes from shared config, gate it: only pass monitoring to non-GPU engines."],"exampleFix":"// before\nengine = GPUEngine(monitoring=True)\nlf.collect(engine=engine)\n\n// after\nengine = GPUEngine()  # monitoring not supported by GPU engine\nlf.collect(engine=engine)","handlingStrategy":"validation","validationCode":"if isinstance(engine, GPUEngine) and getattr(engine, 'monitoring', False):\n    raise ValueError('monitoring is not supported by the GPU engine')","typeGuard":"def monitoring_safe(engine: object) -> bool:\n    return not (isinstance(engine, GPUEngine) and getattr(engine, 'monitoring', False))","tryCatchPattern":null,"preventionTips":["Keep monitoring enabled only for in-memory/streaming engine configs.","Centralize engine construction in one factory that knows engine capability limits."],"tags":["polars","gpu","not-implemented","query-monitoring"],"backgroundTag":"method-not-implemented","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}