jlab-sensing / Rocketlogger-Firmware

MIT License
0 stars 0 forks source link

Recover from errors #29

Open jmadden173 opened 1 year ago

jmadden173 commented 1 year ago

When an exception is thrown, uploader immediately exits relying on systemd to restart it. A better alternative would be to catch the error and continue. Two examples thus far

  1. When RLs were moved to the farm they were still configured to uploader over HTTP. There is no internet connection so uploader exited, and notably not logging to the CSV, resulting in data loss.
  2. The SSL certificates expired on the jlab server resulting in the following error and data loss
    Traceback (most recent call last):
    File "/usr/local/bin/uploader", line 8, in <module>
    sys.exit(cli())
    File "/usr/local/lib/python3.7/dist-packages/dirtviz_uploader/main.py", line 265, in cli
    r = requests.post(endpoint, json=f)
    File "/usr/lib/python3/dist-packages/requests/api.py", line 116, in post
    return request('post', url, data=data, json=json, **kwargs)
    File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
    File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
    File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
    File "/usr/lib/python3/dist-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
    requests.exceptions.SSLError: HTTPSConnectionPool(host='dirtviz.jlab.ucsc.edu', port=443): Max retries exceeded with url: /api/power/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1056)')))