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

Implement KeyboardInterrupt termination #309

Merged
merged 4 commits into from
Jan 4, 2023

Conversation

relf
Copy link
Contributor

@relf relf commented Jan 3, 2023

Following discussion here, this PR implements the KeyboardInterrupt termination handling.

I've tested that it works properly with my solver.

As a follow-up discussion, I do not need the finalize method as initially I introduced it as a way to have a hook just at the end of the loop to check the NotTerminated and max iter not reached to detect keyboard interrupt like the existing check at the end of the run function.

Now that KeyboardInterrupt is handled I think this last check to set Aborted is useless as well, as the state is always terminated, if you're ok I remove it.

Copy link
Member

@stefan-k stefan-k left a comment

Choose a reason for hiding this comment

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

Thanks! I only have a minor comment and I agree that the old awkward check can be removed. I'm fine with not adding finalize for now.

argmin/src/core/executor.rs Outdated Show resolved Hide resolved
argmin/src/core/executor.rs Outdated Show resolved Hide resolved
Copy link
Member

@stefan-k stefan-k left a comment

Choose a reason for hiding this comment

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

Perfect, thanks!

@stefan-k stefan-k merged commit 1d4c9fa into argmin-rs:main Jan 4, 2023
@relf relf deleted the keyboard-interrupt branch January 4, 2023 09:23
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.

None yet

2 participants