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

DM-45340: Improve exception handling in quantum executors #297

Merged
merged 2 commits into from
Jul 24, 2024

Conversation

andy-slac
Copy link
Collaborator

This should solve an issue with exceptions happening at unpredictable locations in a SingleQuantumExecutor class. MPGraphExecutor in a single-process mode should also behave reasonably for random exceptions. Multi-process mode has more complex internal state. If a client of the code catches an exception and tries to reuse the executor, the state may be inconsistent, depending on where the exception happens.

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 88.57143% with 12 lines in your changes missing coverage. Please review.

Project coverage is 87.28%. Comparing base (efd0d94) to head (cb84fe4).

Files Patch % Lines
tests/test_executors.py 90.36% 3 Missing and 5 partials ⚠️
python/lsst/ctrl/mpexec/mpGraphExecutor.py 76.47% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #297      +/-   ##
==========================================
+ Coverage   87.25%   87.28%   +0.03%     
==========================================
  Files          50       50              
  Lines        4581     4585       +4     
  Branches      788      788              
==========================================
+ Hits         3997     4002       +5     
  Misses        422      422              
+ Partials      162      161       -1     

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

Copy link
Member

@kfindeisen kfindeisen left a comment

Choose a reason for hiding this comment

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

This PR doesn't actually fix the problem -- the new code in MpGraphExecutor is exactly as vulnerable to interrupts as the old code in SingleQuantumExecutor was (raising in the first task instead of a later one was a red herring). Having now seen the code for myself, I suspect catching the exception from getReport is the best solution.

I also recommend doing updates, code style, and maintenance on separate commits from the main work; it usually makes sense to do them first.

python/lsst/ctrl/mpexec/mpGraphExecutor.py Show resolved Hide resolved
tests/test_executors.py Outdated Show resolved Hide resolved
@andy-slac
Copy link
Collaborator Author

@kfindeisen, I am certain that this indeed fixes the problem. Can you reproduce the crash that you saw before?

This should solve an issue with exceptions happening at unpredictable
locations in a SingleQuantumExecutor class. MPGraphExecutor in a single-process
mode should also behave reasonably for random exceptions. Multi-process mode
has more complex internal state. If a client of the code catches an exception
and tries to reuse the executor, the state may be inconsistent, depending
on where the exception happens.
Copy link
Member

@kfindeisen kfindeisen left a comment

Choose a reason for hiding this comment

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

Looks much better, thanks.

tests/test_executors.py Show resolved Hide resolved
@andy-slac andy-slac merged commit 4fa1592 into main Jul 24, 2024
15 checks passed
@andy-slac andy-slac deleted the tickets/DM-45340 branch July 24, 2024 21:28
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