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

Remove Parsing of C++ Exception String #10637

Closed
wants to merge 15 commits into from

Conversation

codereport
Copy link
Contributor

This job resolves half of #10632 and a part of #10200.

Currently, in certain places in cuDF Python we parse the string messages returned from C++ std::exception::what. This should be removed and replaced by returning a more appropriate exception that Cython can automatically handle. If there is no "appropriate" exception, then a custom exception should be created and the Cython machinery should be written to handle it.

@codereport codereport added 2 - In Progress Currently a work in progress libcudf Affects libcudf (C++/CUDA) code. Python Affects Python cuDF API. improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Apr 11, 2022
@codereport codereport self-assigned this Apr 11, 2022
@github-actions github-actions bot removed the Python Affects Python cuDF API. label Apr 11, 2022
@codecov
Copy link

codecov bot commented Apr 18, 2022

Codecov Report

❗ No coverage uploaded for pull request base (branch-22.08@e0003a0). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@               Coverage Diff               @@
##             branch-22.08   #10637   +/-   ##
===============================================
  Coverage                ?   86.31%           
===============================================
  Files                   ?      144           
  Lines                   ?    22751           
  Branches                ?        0           
===============================================
  Hits                    ?    19637           
  Misses                  ?     3114           
  Partials                ?        0           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

* Example usage:
*
* @code
* CUDF_EXPECTS(lhs->dtype == rhs->dtype, "Column type mismatch");
* // throws cudf::logic_error
* CUDF_EXPECTS(lhs.type() != rhs.type(), "Column type mismatch");
Copy link
Contributor

Choose a reason for hiding this comment

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

== ? (or else this is expecting lhs and rhs to having mismatching types so the error string is backwards?)

Comment on lines +95 to +96
* @param[in] _expection_type The exception type to throw; must inherit
* `std::exception`. If not specified (i.e. if only two macro
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a static_assert for this while we're at it.

#define GET_CUDF_FAIL_MACRO(_1, _2, NAME, ...) NAME
#define CUDF_FAIL_2(_what, _exception_type) \
/*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \
throw _exception_type{"cuDF failure at:" __FILE__ ":" CUDF_STRINGIFY(__LINE__) ": " _what};
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe for DRY this should just call CUDF_EXPECTS(false, _exception_type, _what)?

@@ -114,8 +114,14 @@ struct TypeList<Types<TYPES...>> {
exception); \
} while (0)

#define CUDF_EXPECT_THROW_MESSAGE(x, msg) \
EXPECT_THROW_MESSAGE(x, cudf::logic_error, "cuDF failure at:", msg)
#define CUDF_EXPECT_THROW_MESSAGE(...) \
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know when these test macros snuck in, but I recall a long time ago advocating strongly against them. I think it's fragile and unimportant for us to be testing for the exact contents of an exceptions error message.

Don't block this PR on removing these, but file it away in your memory banks for future work.

@github-actions github-actions bot added CMake CMake build issue conda Java Affects Java cuDF API. labels May 25, 2022
@github-actions github-actions bot added the gpuCI label May 25, 2022
@codereport codereport changed the base branch from branch-22.06 to branch-22.08 May 25, 2022 13:54
@github-actions
Copy link

This PR has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this PR if it is no longer required. Otherwise, please respond with a comment indicating any updates. This PR will be labeled inactive-90d if there is no activity in the next 60 days.

@github-actions github-actions bot removed CMake CMake build issue conda Java Affects Java cuDF API. labels Jun 27, 2022
@github-actions
Copy link

This PR has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this PR if it is no longer required. Otherwise, please respond with a comment indicating any updates.

@vyasr
Copy link
Contributor

vyasr commented Dec 19, 2022

I'm going to close this PR. The changes to our macros have been completed in #12078. I'll move the C++ changes into a new PR along with the associated Python changes needed to address #10632.

@vyasr vyasr closed this Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 - In Progress Currently a work in progress improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants