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

Explicitly release MOSEK licenses when optimize() raises a mosek.Error #2593

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

jsiirola
Copy link
Member

@jsiirola jsiirola commented Nov 1, 2022

Fixes # .

Summary/Motivation:

MOSEK is not good about releasing licenses if t raises an exception (mosek.Error) from within optimize(). This PR works around that by explicitly releasing all licenses in the event that optimize() raises an exception.

This was discovered through the test_writers.py QCP and MIQCP tests (which test a series of expected failures for MOSEK in rapid succession, resulting in as many as 9 licenses being consumed).

Changes proposed in this PR:

  • explicitly release MOSEK licenses when MOSEK raises an exception

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@jsiirola jsiirola requested a review from mrmundt November 1, 2022 18:04
@codecov
Copy link

codecov bot commented Nov 2, 2022

Codecov Report

Base: 86.76% // Head: 86.74% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (5e98a3e) compared to base (d8de0d0).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2593      +/-   ##
==========================================
- Coverage   86.76%   86.74%   -0.02%     
==========================================
  Files         726      726              
  Lines       81227    81228       +1     
==========================================
- Hits        70476    70462      -14     
- Misses      10751    10766      +15     
Flag Coverage Δ
linux 84.14% <0.00%> (+<0.01%) ⬆️
osx 74.47% <0.00%> (-0.01%) ⬇️
other 84.32% <0.00%> (-0.01%) ⬇️
win 80.92% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pyomo/solvers/plugins/solvers/mosek_direct.py 68.64% <100.00%> (+0.04%) ⬆️
pyomo/kernel/__init__.py 77.90% <0.00%> (-22.10%) ⬇️
pyomo/contrib/mindtpy/iterate.py 84.16% <0.00%> (+1.80%) ⬆️

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.

@jsiirola jsiirola merged commit 65b9a58 into Pyomo:main Nov 2, 2022
@jsiirola jsiirola deleted the mosek-licenses branch November 2, 2022 14:15
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.

2 participants