Integrating new Stage Pi logic into the system

Sub-forum to hold jobs lists
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Integrating new Stage Pi logic into the system

Post by hamishmb »

I decided to make a new thread to summarise the steps we'd need to do when merging Patrick's new code with the code in the master branch.
  • Wait for Patrick to tell me (Hamish) that he's all done and ready for me to begin integration (I guess this could be done with a pull request on GitLab) - Done 13/10/2020
  • I will then test the software (including the unit tests) in the pi VMs - Done 30/10/2020
    • This would be an ideal time for me to raise any queries or confusion I have about the code and/or its behaviour. Done
    • Fixed bug Hamish found in the unit tests - Done
  • I will then integrate the code with the master branch - Done
    • Run all unit tests again - Done
    • Run in VMs again - Done
    • Several integration issues will probably need fixing, but as pointed out by Patrick it's likely to be quite painless - Done, I think *see latest post*
    • I will also fix my unit test bug in master (unrelated to the new code) - Done
  • I (and perhaps also Patrick) will then test the code again in the VMs, including the unit tests - Done
  • I will then test the code a final time with all of the virtual pis corresponding to the real pis in the current system deployed at WMT - Done
  • The Stage Pi and Stage Gate Valve will both need to be powered on at this point.
  • We will then deploy the code with someone on-site to perform emergency remedial action in case everything goes badly wrong.
  • Finally, we will need to monitor the changed system closely for at least a week or so to ensure it's working and make any adjustments needed.
Please note: I'm probably forgotten some stuff - additions welcome.
Last edited by hamishmb on 24/11/2020, 18:31, edited 13 times in total.
Hamish
wmtprojectsforum
Amministratore
Posts: 73
Joined: 16/05/2017, 16:24

Re: Integrating new Stage Pi logic into the system

Post by wmtprojectsforum »

Moved because I should have posted it here in the first place.
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Integrating new Stage Pi logic into the system

Post by hamishmb »

Hamish
PatrickW
Posts: 146
Joined: 25/11/2019, 13:34

Re: Integrating new Stage Pi logic into the system

Post by PatrickW »

I have submitted a merge request on GitLab. I think that's the same thing as a pull request.
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Integrating new Stage Pi logic into the system

Post by hamishmb »

Yep, that's right. I'll try to review it soon.
Hamish
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Integrating new Stage Pi logic into the system

Post by hamishmb »

Okay, I have experienced a few issues Patrick, and I have texted you about them. Quite possibly I'm doing things wrong/in the wrong order, I'm not sure.
Hamish
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Integrating new Stage Pi logic into the system

Post by hamishmb »

The code has now been tested and merged, and I am now beginning the integration process (which shouldn't take long).

After that, I'll tackle a few of the more high importance post-merge jobs at viewtopic.php?f=14&t=237&start=20 before signing this off as ready for deployment at WMT.
Hamish
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Integrating new Stage Pi logic into the system

Post by hamishmb »

Unit tests run for the second time, all is good. I'm now going to try and integrate with my code. I'm very busy with many different things at the moment, but hopefully I'll be able to get around to it fairly quickly - I don't want to keep everyone waiting.
Hamish
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Integrating new Stage Pi logic into the system

Post by hamishmb »

Okay, I have moved the control logic integration and setup functions to a new file, Logic/controllogic.py. My old control logic is also in there, because having is separated into multiple files like Logic/stagepilogic.py isn't a good fit for it. I'm guessing this can instead be done later when/if hysteresis is added in due course.

I have updated the unit tests to reflect the new location of the functions, and integrated Patrick's stage pi logic tests into the test suites offered by unittests.py.

I have also made some other changes, and I will summarise them shortly in the General Software Improvements topic.

Of note, is that when I tested the unit test coverage, it seems to have dropped from ~80% to ~68% since July. This doesn't necessarily matter, just noting. I've attached an image showing the figures for each file, and the html output (browse by going to index.html first). Surprisingly for a system so complex, we only have just over 2000 lines of code here, ignore documentation, whitespace etc.

The output is very useful as it shows exactly which lines were tested, so now is a good time to note anything that we are concerned about so we can improve it before we deploy anything.
Attachments
HTML Coverage.zip
(483.84 KiB) Downloaded 70 times
River sw Coverage report.png
River sw Coverage report.png (110.47 KiB) Viewed 916 times
Hamish
PatrickW
Posts: 146
Joined: 25/11/2019, 13:34

Re: Integrating new Stage Pi logic into the system

Post by PatrickW »

Concerning myself only with the coverage report for stagepilogic.py, the lines that haven't been covered are almost all to do with exceptions, which, as discussed, I haven't written the tests for yet. If I write those tests, that file should get up to 99%. These were tests that we decided were not important enough to hold up the merge. In other words, the 72% coverage has been deemed acceptable for now.

By the same token, if I write the test(s) for stagepi_control_logic, it'll bump the coverage for controllogic.py up by a dozen lines or so.
Post Reply