Commit c02b5fdc authored by Patrick Dohmen's avatar Patrick Dohmen

Fix issue #310

 - Re-order code execution to ensure data files are processed
 - catch some exceptions on the metadata-put-request
parent 1bef52e1
Pipeline #22720303 passed with stage
in 3 minutes and 16 seconds
......@@ -156,17 +156,6 @@ class Observer(object):
client_metadata['latitude'] = settings.SATNOGS_STATION_LAT
client_metadata['longitude'] = settings.SATNOGS_STATION_LON
client_metadata['elevation'] = settings.SATNOGS_STATION_ELEV
resp = requests.put(
url, headers=headers,
data={'client_version': satnogsclient.config.VERSION,
'client_metadata': json.dumps(client_metadata)},
verify=settings.SATNOGS_VERIFY_SSL,
stream=True,
timeout=45)
if resp.status_code == 200:
LOGGER.info('Success: status code 200')
else:
LOGGER.error('Bad status code: %s', resp.status_code)
if "satnogs_generic_iq_receiver.py" not in settings.GNURADIO_SCRIPT_FILENAME:
LOGGER.info('Rename encoded files for uploading.')
......@@ -175,6 +164,24 @@ class Observer(object):
LOGGER.info('Creating waterfall plot.')
self.plot_waterfall()
try:
resp = requests.put(
url, headers=headers,
data={'client_version': satnogsclient.config.VERSION,
'client_metadata': json.dumps(client_metadata)},
verify=settings.SATNOGS_VERIFY_SSL,
stream=True,
timeout=45)
except requests.exceptions.ConnectionError:
LOGGER.error('%s: Connection Refused', url)
except requests.exceptions.Timeout:
LOGGER.error('%s: Connection Timeout - no metadata uploaded', url)
if resp.status_code == 200:
LOGGER.info('Success: status code 200')
else:
LOGGER.error('Bad status code: %s', resp.status_code)
def run_rot(self):
self.tracker_rot = WorkerTrack(ip=self.rot_ip,
port=self.rot_port,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment