From 06becedf9d359875b58870928827a22fee51f2e2 Mon Sep 17 00:00:00 2001 From: Matthew Murray Date: Thu, 26 Sep 2024 11:16:23 -0700 Subject: [PATCH] [DOC] Document environment variable for failing on fallback in cudf.pandas --- .../cudf/source/developer_guide/cudf_pandas.md | 18 ++++++++++++++++++ python/cudf/cudf/pandas/fast_slow_proxy.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/cudf/source/developer_guide/cudf_pandas.md b/docs/cudf/source/developer_guide/cudf_pandas.md index a8a6d81d6fb..911a64fa152 100644 --- a/docs/cudf/source/developer_guide/cudf_pandas.md +++ b/docs/cudf/source/developer_guide/cudf_pandas.md @@ -136,3 +136,21 @@ Arrays are not almost equal to 7 decimals ACTUAL: 1.0 DESIRED: 2.0. ``` + +Setting the environment variable `CUDF_PANDAS_FAIL_ON_FALLBACK` causes `cudf.pandas` to fail when falling back from cuDF to Pandas. +For example, +```python +import cudf.pandas +cudf.pandas.install() +import pandas as pd +import numpy as np + +df = pd.DataFrame({ + 'complex_col': [1 + 2j, 3 + 4j, 5 + 6j] +}) + +print(df) +``` +``` +ProxyFallbackError: The operation failed with cuDF, the reason was : Series with Complex128DType is not supported. +``` diff --git a/python/cudf/cudf/pandas/fast_slow_proxy.py b/python/cudf/cudf/pandas/fast_slow_proxy.py index 0c1cda8810b..c364d55e677 100644 --- a/python/cudf/cudf/pandas/fast_slow_proxy.py +++ b/python/cudf/cudf/pandas/fast_slow_proxy.py @@ -965,7 +965,7 @@ def _fast_slow_function_call( except Exception as err: if _env_get_bool("CUDF_PANDAS_FAIL_ON_FALLBACK", False): raise ProxyFallbackError( - f"The operation failed with cuDF, the reason was {type(err)}: {err}." + f"The operation failed with cuDF, the reason was {type(err)}: {err}" ) from err with nvtx.annotate( "EXECUTE_SLOW",