Client uploads incompletely generated OGG and PNG files resulting in blank waterfalls and audio
It seems the new client will upload waterfall PNG and audio OGG files before they have been complete written.
This results in blank waterfalls on observation pages, and zero-length audio. This observation is an example: https://network.satnogs.org/observations/1862596/
As network throws a 403 when the file already exists, the client sits there continually trying to upload the files, forever. #359 will fix that, but it will mean that the real data is lost.
Maybe file sizes could be used as at least some sanity check before uploading? The 'blank' waterfall is only 28kb in size, whereas a complete waterfall is about 1.8 MB. Similarly, the blank audio file is only a few tens of kb
On a related note, when my client hits the 403 error, it throws another exception due to type issues in the exception handling:
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: --- Logging error ---
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: Traceback (most recent call last):
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: File "/var/lib/satnogs/lib/python3.7/site-packages/satnogsclient/scheduler/tasks.py", line 128, in post_data
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: response.raise_for_status()
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: raise HTTPError(http_error_msg, response=self)
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://network.satnogs.org/api/observations/1862595/
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: During handling of the above exception, another exception occurred:
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: Traceback (most recent call last):
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: File "/usr/lib/python3.7/logging/__init__.py", line 1034, in emit
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: msg = self.format(record)
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: File "/usr/lib/python3.7/logging/__init__.py", line 880, in format
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: return fmt.format(record)
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: File "/usr/lib/python3.7/logging/__init__.py", line 619, in format
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: record.message = record.getMessage()
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: File "/usr/lib/python3.7/logging/__init__.py", line 380, in getMessage
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: msg = msg % self.args
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: TypeError: %i format: a number is required, not str
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: Call stack:
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: File "/usr/lib/python3.7/threading.py", line 885, in _bootstrap
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: self._bootstrap_inner()
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: self.run()
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: File "/usr/lib/python3.7/threading.py", line 865, in run
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: self._target(*self._args, **self._kwargs)
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: File "/usr/lib/python3.7/concurrent/futures/thread.py", line 80, in _worker
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: work_item.run()
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: result = self.fn(*self.args, **self.kwargs)
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: File "/usr/lib/python3/dist-packages/apscheduler/executors/base.py", line 125, in run_job
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: retval = job.func(*job.args, **job.kwargs)
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: File "/var/lib/satnogs/lib/python3.7/site-packages/satnogsclient/scheduler/tasks.py", line 153, in post_data
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: 'response status code: %s', fil, observation_id, response.status_code)
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: Message: 'Upload of %s for observation %i failed, response status code: %s'
Mar 14 09:38:14 satnogs2 satnogs-client[3028]: Arguments: ('satnogs_1862595_2020-03-14T09-09-52.ogg', '1862595', 403)