Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise errors on specific types of fallback in cudf.pandas #17268

Open
wants to merge 2 commits into
base: branch-24.12
Choose a base branch
from

Conversation

Matt711
Copy link
Contributor

@Matt711 Matt711 commented Nov 7, 2024

Description

Closes #14975

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@Matt711 Matt711 added feature request New feature or request non-breaking Non-breaking change labels Nov 7, 2024
@Matt711 Matt711 self-assigned this Nov 7, 2024
@github-actions github-actions bot added Python Affects Python cuDF API. cudf.pandas Issues specific to cudf.pandas labels Nov 7, 2024
@Matt711 Matt711 marked this pull request as ready for review November 7, 2024 21:04
@Matt711 Matt711 requested a review from a team as a code owner November 7, 2024 21:04
@Matt711 Matt711 requested review from vyasr and bdice November 7, 2024 21:04
Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be super helpful, thanks Matt! I have some suggestions to clean things up and make the reporting a little more informative.

@@ -881,12 +883,36 @@ def _assert_fast_slow_eq(left, right):
assert_eq(left, right)


class ProxyFallbackError(Exception):
class FallbackError(Exception):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For debugging purposes it might be helpful to store func.__name__ from _fast_slow_function_call into the exception.

"""Raised when fallback occurs"""

pass


class OOMFallbackError(FallbackError):
"""Warns when cuDF produces a MemoryError or an rmm.RMMError"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the docstrings should say "Raises" instead of Warns".

raise OOMFallbackError(
"Out of Memory Error. Falling back to the slow path. "
f"The exception was {err}."
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would decorate all of these raises with a from err so that we get the full exception chain (see the docs on the from clause if you're not familiar).

"mock_mean, err, match_str",
[
(
mock_mean_memory_error,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these are all single-use functions I'd suggest using lambdas instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cudf.pandas Issues specific to cudf.pandas feature request New feature or request non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
Status: In Progress
Status: In Progress
Development

Successfully merging this pull request may close these issues.

[FEA] Offer more control over CPU fallback in cudf.pandas
2 participants