ISISComputingGroup / lewis-ess

Let's write intricate simulators!
GNU General Public License v3.0
21 stars 19 forks source link

Move control server to separate thread #264

Closed MichaelWedel closed 6 years ago

MichaelWedel commented 7 years ago

This change moves the control server into a separate thread. This makes lewis-control a lot more responsive.

To test, start a device with control server enabled:

$ lewis -r localhost:10000 -k lewis.examples example_motor

In a different terminal, run:

$ lewis-control simulation

The output should appear more or less instantaneously. I had to modify the code for catching the keyboard interrupt slightly, there's a finally clause now that stops the simulation, doing a proper shutdown of any adapters and the control server. Otherwise the control server can not exit (_stop_commanded never gets set).

MikeHart85 commented 6 years ago

Looks great!

Should also be added to release notes though. Since the control server is so much more responsive, and many updates are possible now during a single cycle, this can have an effect on existing control API driven testing scripts and the like.

The release notes file has moved in the master branch, since the next version will now be 1.2, so it might be best to rebase this to a newer master as well.

PS: Could you drop by our Slack when you have time?

MikeHart85 commented 6 years ago

This is a pretty significant change, so I've moved the release note entry up to the new features section. I've also reworded it a little bit.

Looks good to merge to me, going to leave it open for a while in case you want to review my changes to the notes.

Feel free to hit the merge button if all looks good!