-
Notifications
You must be signed in to change notification settings - Fork 27
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
Feature/capps2/successreturnvalue #1224
Conversation
There are several ways we could add a boolean return value to load, save, and loadExternalData. This is one. Alternately, we could
|
…apps2/successreturnvalue
…e' into feature/capps2/successreturnvalue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change in the PR would require a single global DataStore instance.
Is there a way to satisfy this issue without using global state?
E.g. registering a callback with conduit that modifies a local variable if there's an error? Or locally catching the conduit exception?
Not sure how it requires a single global DataStore instance.
As I wrote, I would prefer storing the error flag as an instance variable on DataStore. The (possibly minor) obstacle is that |
After a spirited discussion on November 27 2023, the consensus was that we (Axom developers) don't like the static global variable. Within This idea will let us be more specific when reporting what happened, and allows each DataStore to hold its own state. I'll rework the PR to reflect this idea and resubmit for review. |
What I meant was that if you had more than one
|
…apps2/successreturnvalue
…the error handlers.
…apps2/successreturnvalue
…e' into feature/capps2/successreturnvalue
@nselliott , @kennyweiss , @cyrush , @rhornung67 , I'd appreciate your reviews. Thanks. |
Co-authored-by: Rich Hornung <hornung1@llnl.gov>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Arlie. Approving with one comment on a small thing that should be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @agcapps
Looks good overall.
My main question relates to resetting the error flags -- whose responsibility is it and when does it occur?
src/axom/sidre/core/Group.cpp
Outdated
SLIC_ERROR(SIDRE_GROUP_LOG_PREPEND << "Invalid protocol '" << protocol | ||
<< "' for save with hdf5 handle."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, the code should return false if an invalid protocol was passed.
Please also check the other similar cases.
(Note SLIC_ERROR
can be configured to not call exit
).
void appendToConduitErrors(const std::string& mesg) const | ||
{ | ||
m_conduit_errors = m_conduit_errors + "\n" + mesg; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a std::list<std::string>
(or similar) be better than appending strings on the fly?
A benefit would be that DataStore would not need to explicitly manage a separate bool
for m_conduit_error_occurred
-- it could instead be m_conduit_errors.empty()
.
@@ -1808,7 +1808,7 @@ TEST(sidre_group, save_restore_empty_datastore) | |||
for(const auto& protocol : protocols) | |||
{ | |||
const std::string file_path = file_path_base + protocol; | |||
ds1->getRoot()->save(file_path, protocol); | |||
EXPECT_TRUE(ds1->getRoot()->save(file_path, protocol)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any cases that test the EXPECT_FALSE
path?
E.g. by setting slic::disableAbortOnError()
axom/src/axom/slic/interface/slic.hpp
Lines 133 to 140 in 65dfc3a
/*! | |
* \brief Disables aborts on error messages for the current active logger. | |
* | |
* \note this is equivalent to calling slic::setAbortOnError( false ) | |
* \post slic::isAbortOnErrorsEnabled() == false. | |
* \pre slic::isInitialized() == true | |
*/ | |
void disableAbortOnError(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no cases that test EXPECT_FALSE
, at this point. I should, indeed, try that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests that use EXPECT_FALSE
.
src/axom/sidre/core/Group.cpp
Outdated
m_ds->setConduitErrorOccurred(true); | ||
m_ds->appendToConduitErrors(e.message()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be missing it, but where are the errors cleared?
Is that the user's responsibility? If so, is it documented and/or exercised in the sidre tests and examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user should clear errors as and when the user sees fit. I'm in the process of adding tests and documentation.
The user has the responsibility to reset any error flags, or not, as needed. Most times, the user will probably detect the error and abort the simulation. More sophisticated error-handling is up to the user. |
…apps2/successreturnvalue
…e' into feature/capps2/successreturnvalue
…apps2/successreturnvalue
…apps2/successreturnvalue
…e' into feature/capps2/successreturnvalue
…apps2/successreturnvalue
…e' into feature/capps2/successreturnvalue
Summary
load()
,save()
, andloadExternalData()
Design review
On 13 November 2023, we (re)reviewed this PR. We decided that the extra information to the user was worthy of adding the feature.