CroatianMeteorNetwork / RMS

RPi Meteor Station
https://globalmeteornetwork.org/
GNU General Public License v3.0
178 stars 50 forks source link

Download mask from remote #239

Closed g7gpr closed 9 months ago

g7gpr commented 9 months ago

New feature to allow an updated mask to be downloaded from remote server

g7gpr commented 9 months ago

2023/12/20 23:06:21-INFO-StartCapture-line:771 - Program start
2023/12/20 23:06:21-INFO-StartCapture-line:772 - Station code: AU002A
2023/12/20 23:06:21-INFO-StartCapture-line:786 - Program version: 20231220_230346, c476244234f7f9586c8331e19c506d1bbde5bdb2
2023/12/20 23:06:21-INFO-DownloadMask-line:45 - Mask download enabled
2023/12/20 23:06:21-INFO-DownloadMask-line:51 - Checking for new mask on the server...
2023/12/20 23:06:21-DEBUG-DownloadMask-line:56 - Establishing SSH connection to: gmn.uwo.ca:22...
2023/12/20 23:06:24-INFO-UploadManager-line:72 - Trying ssh-agent key b'a52244b6e5e567f3118ec090cacdfd77'
2023/12/20 23:06:24-INFO-UploadManager-line:77 - ... success!
2023/12/20 23:06:35-INFO-DownloadMask-line:104 - Latest mask downloaded!
2023/12/20 23:06:35-INFO-DownloadMask-line:116 - Remote mask renamed to: files/masks/mask_dl_20231220_230635.544355.bmp
2023/12/20 23:06:35-INFO-StartCapture-line:878 - Starting the event monitor...
2023/12/20 23:06:35-INFO-EventMonitor-line:734 - EventMonitor is starting

Tested on a few stations, ready for wider testing

g7gpr commented 9 months ago

Creates target directory on server, uploads newest flat file, and removes any other flat file.

g7gpr commented 9 months ago
2023/12/21 01:51:12-INFO-DownloadMask-line:51 - Checking for new mask on the server...
2023/12/21 01:51:12-DEBUG-DownloadMask-line:56 - Establishing SSH connection to: gmn.uwo.ca:22...
2023/12/21 01:51:15-INFO-UploadManager-line:72 - Trying ssh-agent key b'6bd4c2aa00616acae54fb53e5fe5aaeb'
2023/12/21 01:51:16-INFO-UploadManager-line:77 - ... success!
2023/12/21 01:51:19-INFO-DownloadMask-line:91 - files/masks exists
2023/12/21 01:51:19-INFO-DownloadMask-line:109 - Most recent flat /home/au002d/RMS_data/CapturedFiles/AU002D_20231219_115503_651280/flat.bmp
2023/12/21 01:51:19-INFO-DownloadMask-line:114 - Uploading to files/masks/ as AU002D_20231219_flat.bmp
2023/12/21 01:51:34-INFO-DownloadMask-line:124 - Not removing newly uploaded file AU002D_20231219_flat.bmp
2023/12/21 01:51:34-INFO-DownloadMask-line:144 - No new mask on the server!
g7gpr commented 9 months ago

This completes issue #238

markmac99 commented 9 months ago

apologies, hope comments aren't too curt - my wife is in a lot of pain today so its been a long day and its late!

g7gpr commented 9 months ago

No problem with the comments; clear and concise is always welcome. Sorry to hear of the pain.

g7gpr commented 9 months ago

There is a potential bug in DownloadMask and also in DownloadPlatepar. It will only appear if an attempt is made to download a new mask or platepar. If there is an sftp error in https://github.com/CroatianMeteorNetwork/RMS/blob/3a4d3058ae05dc30c9e5dd5922d41a8d6d739c0a/RMS/DownloadMask.py#L150 or https://github.com/CroatianMeteorNetwork/RMS/blob/3a4d3058ae05dc30c9e5dd5922d41a8d6d739c0a/RMS/DownloadMask.py#L163 then it will send an unhandled exception up the stack. I'll work on implementing and testing a fix for the functions in both modules.