Water Backup Logic Development

A forum for discussion on the software for the WMT River Control System
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Water Backup Logic Development

Post by TerryJC »

Hamish,

I think I may have just broke it and created a Merge instead of a Merge Request.

I found the syntax error in config.py and pushed the commit back to GitLab. I then couldn't see if the Merge request had worked and then (magically) it become successful and accidentally pressed 'Merge'....

Sorry about that.
Terry
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Water Backup Logic Development

Post by TerryJC »

Apparently the merge was blocked due to conflicts, so I may have got away with it.
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Water Backup Logic Development

Post by hamishmb »

The merge request is just a request for someone else to merge the code, generally. What failed was the pipeline, but it looks like you fixed the syntax error, and then merged the other request that I'd marked as draft.

It's okay, just don't use the code in master until I've tested it (probably tomorrow). You merged the sumppi backup logic, but not the wendy logic. Did you write unit tests for the new logic?

The new (wendy) merge request is now blocked as it contained the commits in the sumppi backup branch too...

I'll fix this later, but next time switch back to master before making a new branch, if that makes sense. That should avoid the conflicts.

It's not a big deal, just don't merge anything else until I've reviewed it :lol:
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Water Backup Logic Development

Post by TerryJC »

hamishmb wrote: 26/05/2022, 14:12It's okay, just don't use the code in master until I've tested it (probably tomorrow). You merged the sumppi backup logic, but not the wendy logic. Did you write unit tests for the new logic?
I certainly won't be using any code for a while; my next job is to assemble the Gate Valve.

I'm not sure if I would know how to write unit tests for the code; it's about 35 years since I wrote software unit tests.
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Water Backup Logic Development

Post by hamishmb »

Okay, I can do that, that's fine.
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Water Backup Logic Development

Post by TerryJC »

Hamish,

I've hit one or two problems while setting the new Gate Valve to work. I started out with an archived copy of the V6 Gate Valve SD Card, taken when I had just started building Valves for the Matrix Pump back in May of last year. I've solved a number of issues that came up (one being a comma missing at the end of line 519 of the latest config.py), but still have a couple remaining.

One which is giving me some stick is that on startup of main.py I get the following error:

Code: Select all

pi@g4bypassgatepi:~/rivercontrolsystem $ ./main.py --id "VALVE6"
Unexpected error 

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/MySQLdb/__init__.py", line 18, in <module>
    from . import _mysql
ImportError: libmariadb.so.3: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./main.py", line 970, in <module>
    run_standalone()
  File "./main.py", line 213, in run_standalone
    from Tools import coretools as core_tools
  File "/home/pi/rivercontrolsystem/Tools/coretools.py", line 42, in <module>
    import MySQLdb as mysql
  File "/home/pi/.local/lib/python3.7/site-packages/MySQLdb/__init__.py", line 24, in <module>
    version_info, _mysql.version_info, _mysql.__file__
NameError: name '_mysql' is not defined
I've so far been unable to install MySQLdb, because I get:

Code: Select all

pi@g4bypassgatepi:~/rivercontrolsystem $ sudo pip3 install MySQL-python
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting MySQL-python
  Downloading https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
    100% |████████████████████████████████| 112kB 452kB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-nck1x461/MySQL-python/setup.py", line 13, in <module>
        from setup_posix import get_config
      File "/tmp/pip-install-nck1x461/MySQL-python/setup_posix.py", line 2, in <module>
        from ConfigParser import SafeConfigParser
    ModuleNotFoundError: No module named 'ConfigParser'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-nck1x461/MySQL-python/
I haven't tried doing a blanket copy of the current code in git as yet, because we are between commits, but if necessary, I'll do so.

Can you shed any light on what is wrong? Presumably this all worked a year ago.
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Water Backup Logic Development

Post by hamishmb »

Hmm, I'm not sure that that's the right pip command. Presumably I can find the instructions in the installation spec?

Edit: It does look like mysqldb is installed, though. Maybe there's a missing dependency somewhere.

I'll get back to you tomorrow.
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Water Backup Logic Development

Post by TerryJC »

hamishmb wrote: 29/05/2022, 19:25Hmm, I'm not sure that that's the right pip command. Presumably I can find the instructions in the installation spec?

Edit: It does look like mysqldb is installed, though. Maybe there's a missing dependency somewhere.

I'll get back to you tomorrow.
Hmmm.

I hadn't recalled ever adding that (more about that below). You are right of course; the information is in the Installation Spec. I'll try the instructions a bit later this morning.

What had thrown me is that I created that SD Card from an image I created and saved in May last year that purported to be for the Matrix Pump V6 Valve. Apart from changing the hostname, it should have 'just worked'.

With hindsight, I suspect that the image was descended from one that I created a year so so before that; before the NAS Box was installed (probably Winter 2018/19); mysqldb isn't mentioned in the old Installation Specs until March 2020, which is about the time the lockdown started. I can recall taking a large batch of Gate Valves into the WMT sometime prior to lockdown, so they wouldn't have had it installed. Presumably you installed mysqldb on all of the pre-existing Pis when you commissioned the NAS Box?
Terry
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Water Backup Logic Development

Post by TerryJC »

All of the packages listed in the Installation Spec are installed, so I followed up on the error by opening /home/pi/.local/lib/python3.7/site-packages/MySQLdb/__init__.py and looking at line 24:

Code: Select all

try:
    from MySQLdb.release import version_info
    from . import _mysql

    assert version_info == _mysql.version_info
except Exception:
    raise ImportError(
        "this is MySQLdb version {}, but _mysql is version {!r}\n_mysql: {!r}".format(
            version_info, _mysql.version_info, _mysql.__file__
        )
    )
I'm not sure what is going on here.

Do you think that I should try a clean installation and ignore the archived SD image? It looks as though buster is still available.
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Water Backup Logic Development

Post by hamishmb »

I would start with a clean installation I think. If buster is still supported for a few years, then as you say we should still be able to download it.

I have a spare raspberry pi 1 here, so if you continue to have issues, I can test the instructions with that. This part of the instructions worked okay on the Debian Buster Pi VMs though, so I think it's something to do with the way the images have changed.

Yes, MySQLdb was installed on all the Pis when I deployed the NAS box.
Hamish
Post Reply