Closed Lachstec closed 4 months ago
absolutely! ctrl+c can already be used to shutdown the controllers etc. If you rerun digsinet-start.py afterwards, contrainerlab will skip the creation and start of already running topologies (unless "--reconfigure" is not used as command line parameter). digsinet-stop.py was more or less initially developed to support stopping and cleaning up all running containerlab instances etc., but as digsinet-start.py and digsinet-stop.py share common code, it might be better to implement a command line parameter "--stop" or "--cleanup" etc. and use only one file? Also, regarding your idea maybe we should check that ctrl+c ensures a graceful shutdown, though I'm pretty confident this should be the case already, besides gNMI ops etc. possibly being interrupted?
update: just saw that you already started working on a branch that uses a single digsinet.py. Looks perfect! Go for it! 🚀
Now also at least partially implemented in main branch. Maybe we can close this issue for now?
Yup! Doing it with a custom SIGINT handler as it is done now is completely fine. I tried it with a similar approach before, but winded up with problems regarding containerlab. Calling sys.exit
should free all used Resources and terminate all child processes.
Idea
Currently, you need to use the two python files
digsinet-start.py
anddigsinet-stop.py
to start and stop the application. It would be more ergonomic if normal ctl+c would gracefully shut down the application.