ersilia-os / ersilia-pack

Module to pack Ersilia models with FastAPI
GNU General Public License v3.0
1 stars 6 forks source link

Environment installation to stop on KeyboardInterrupt #35

Open MissTife opened 4 weeks ago

MissTife commented 4 weeks ago

Thank you for taking your time to contribute to Ersilia, just a few checks before we proceed

[xx] Have you followed the guidelines in our Contribution Guide [xx] Have you written new tests for your core changes, as applicable? [xx] Have you successfully ran tests with your changes locally?

Description This pull request addresses the issue where pressing CTRL + C does not terminate the environment installation process when using conda. Each conda installation starts a new process, leading to multiple processes running even after a keyboard interrupt. The solution implements a signal handler to properly catch the interrupt signal and terminate all running conda installation processes.

Changes to be made

Added a signal handler to capture SIGINT (keyboard interrupt) and set a flag to terminate ongoing installation processes. Modified the _install_packages method to periodically check for this termination flag and terminate all subprocesses when CTRL + C is pressed. Included logging statements to inform the user when the installation process is terminated due to an interrupt. Status Ready for review

To do Pull request to be reviewed by mentors.

Is this pull request related to any open issue? If yes, replace issueID below with the issue ID Related to issue ID: #9

DhanshreeA commented 3 weeks ago

@MissTife this is actually a pretty cool implementation. Were you able to test this?

MissTife commented 3 weeks ago

@DhanshreeA Thank you ma. Yes I was able to test it and the installation now gets interrupted by pressing ctrl +c and the installation did not continue.