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

Retrieve solution before closing the gurobi env #193

Merged
merged 1 commit into from
Oct 31, 2023

Conversation

dannyopts
Copy link
Contributor

Currently the Gurobi env is closed before the solution has been retrieved and this can result in an exception being thrown based on a race condition (described in the issue referenced below)

Fixes #192

@codecov
Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (7e76a67) 89.22% compared to head (dc7c996) 89.25%.
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #193      +/-   ##
==========================================
+ Coverage   89.22%   89.25%   +0.03%     
==========================================
  Files          15       15              
  Lines        3136     3182      +46     
  Branches      723      731       +8     
==========================================
+ Hits         2798     2840      +42     
- Misses        234      237       +3     
- Partials      104      105       +1     
Files Coverage Δ
linopy/solvers.py 90.10% <88.88%> (+0.16%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dannyopts
Copy link
Contributor Author

Does the fact coverage has gone down mean we cant merge this PR?

It seems to me this is not a change that would require a test, but if it would normally be accompanied by a test, can someone give me a steer what that would look like?

@FabianHofmann
Copy link
Collaborator

Thanks @dannyopts, the diffs are a bit hard to read. But it seems you intended the block which was not in the with block, is that right? I would not worry about the code coverage of the patch.

@dannyopts
Copy link
Contributor Author

@FabianHofmann yes exactly, we dont exit the stack until after we have read the solution so the gurobi env is not destroyed.

@FabianHofmann
Copy link
Collaborator

great, thanks!

@FabianHofmann FabianHofmann merged commit 09234b8 into PyPSA:master Oct 31, 2023
11 of 12 checks passed
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.

Gurobi race condition
2 participants