Open schoonhovenrichard opened 4 years ago
The system does support dynamically registering and unregistering plugins, so it is definitely possible to make a change to a plugin while running, and to kill/restart it.
IIRC, multithreaded Python scripts intercept the kill signal and don’t shut down.
Ctrl+Z does not kill a process, but just sends it to the background and pauses it. You can use jobs
to see the current bg jobs (active and paused) and kill them with kill %x
where x is the number shown in the jobs
output. This should work for the plugin, and allow you to restart it.
After restarting it, trigger a slice reconstruction by clicking on a slice in RECAST3D, and you should see output for the new plugin.
There are three improvements to the code that can be done to make this use case more streamlined. It would be a good learning experience if anyone would like to try and tackle this.
I am also willing to work on making multi-scene and dynamic plugins a bit more streamlined (and to avoid crashing components of the pipeline because the endpoint disconnects without warning), but they are not a high priority. The dynamic plugins are only relevant for development so I can accept the manual refresh, killing Python scripts can be done with ctrl+Z
followed by kill %
, and while the crash is ugly we want to the software to close there anyway 🤷♂️.
— JW
Does this problem still arise on develop? Curious if #1 fixed this. Points 1,2 are still very welcome though.
When trying to kill a SliceRecon process I run into several problems.
Firstly, I start 4 terminals as follows: Terminal 1) recast3d, Terminal 2) ./slicerecon_server --slice-size et.c Terminal 3) ./slicerecon_push_tomos --parallel (this one finishes the process on its own) Terminal 4) python slicerecon_plugin.py
I have not found a way to kill these processes without some "ZMQbg/1" process remaining alive.
Option A, killing from SliceVisualizer:
Option B, killing from terminal:
I am unsure how the correct procedure to kill SliceRecon and the plugins should be implemented. Any thoughts?
PS: One reason why this is relevant is that when developing a python plugin, ideally we would keep the first 3 terminals active, see the result of the plugin, kill the pluging to make some changes en restart it again. I don't know if SliceRecon supports reconnecting a plugin in this way but it could probably be implemented if the visualization server has some loop which tries to reconnect. Currently, we can kill only the Python process in Terminal 4, run kill the "ZMQbg/1" but then restarting the python plugin does not work.