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

hard crash if one Xpress function not found #116

Merged

Conversation

sgatto
Copy link
Member

@sgatto sgatto commented Nov 20, 2023

ortools by google uses a dynamic_library that performs a hard check on the successful load of every function.
RTE developed a different, softer approach that is more refined.
Here I propose to revert to the google version and drop RTE version in order for our development to be more easily accepted in the official repository.

@sgatto
Copy link
Member Author

sgatto commented Nov 20, 2023

The latest development by google make the Python 3.8 CI actions to crash.

@sgatto sgatto requested review from flomnes and pet-mit November 20, 2023 17:32
@@ -244,7 +236,9 @@ absl::Status LoadXpressDynamicLibrary(std::string& xpresspath) {
}

if (xpress_library.LibraryIsLoaded()) {
xpress_load_status = LoadXpressFunctions(&xpress_library);
LOG(INFO) << "Loading all Xpress functions";
LoadXpressFunctions(&xpress_library);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Error handling isn't so great here. Shouldn't we return an absl::status here ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I cannot find a way to do it.
LoadXpressFunctions calls DynamicLibrary.GetFunction(const char* function_name)

DynamicLibrary.GetFunction(const char* function_name) executes the CHECK macro that seems to throw a fatal error. I tried to catch it but i probably did not figure out how to do it properly.
Gurobi interface uses the same approach you see here and in the end we can consider that
not having Xpress installed is ok
having the wrong xpress installation is worse

Copy link
Member Author

@sgatto sgatto Nov 21, 2023

Choose a reason for hiding this comment

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

I am open to change this behavior but at the moment I cannot see how to do it without touching the dynamic_library.h file

Copy link
Collaborator

Choose a reason for hiding this comment

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

If Google are open to change, it would be easier to suggest an overhaul of dynamic_library.h like we had before

@flomnes
Copy link
Collaborator

flomnes commented Nov 21, 2023

Suggestion:
If one function is missing, mark XPRESS as unavailable instead of a "hard crash".

@sgatto
Copy link
Member Author

sgatto commented Nov 21, 2023

Suggestion: If one function is missing, mark XPRESS as unavailable instead of a "hard crash".

I have tried it, but I can't figure out how to catch the exception thrown by the CHECK macro here

I reproduced the same pattern used for the Gurobi interface

@sgatto sgatto merged commit e825775 into feature/xpress_only_RTE Nov 21, 2023
15 of 17 checks passed
@sgatto sgatto deleted the feature/dynamic_library_use_google_version branch November 21, 2023 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants