Remove time limit in sync_to_db task
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>merge-requests/837/head
parent
69b694b5df
commit
991330fdb8
|
@ -19,7 +19,7 @@ from satellite_tle import fetch_tles
|
||||||
|
|
||||||
from network.base.models import DemodData, LatestTle, Observation, Satellite, \
|
from network.base.models import DemodData, LatestTle, Observation, Satellite, \
|
||||||
Station, Tle, Transmitter
|
Station, Tle, Transmitter
|
||||||
from network.base.utils import demod_to_db
|
from network.base.utils import sync_demoddata_to_db
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
|
@ -160,18 +160,16 @@ def clean_observations():
|
||||||
@shared_task
|
@shared_task
|
||||||
def sync_to_db():
|
def sync_to_db():
|
||||||
"""Task to send demod data to SatNOGS DB / SiDS"""
|
"""Task to send demod data to SatNOGS DB / SiDS"""
|
||||||
period = now() - timedelta(days=1)
|
|
||||||
transmitters = Transmitter.objects.filter(sync_to_db=True).values_list('uuid', flat=True)
|
transmitters = Transmitter.objects.filter(sync_to_db=True).values_list('uuid', flat=True)
|
||||||
|
|
||||||
frames = DemodData.objects.filter(
|
frames = DemodData.objects.filter(
|
||||||
observation__end__gte=period,
|
copied_to_db=False, observation__transmitter_uuid__in=transmitters
|
||||||
copied_to_db=False,
|
|
||||||
observation__transmitter_uuid__in=transmitters
|
|
||||||
)
|
)
|
||||||
for frame in frames:
|
for frame in frames:
|
||||||
try:
|
try:
|
||||||
if not frame.is_image() and not frame.copied_to_db:
|
if not frame.is_image() and not frame.copied_to_db:
|
||||||
if os.path.isfile(frame.payload_demod.path):
|
if os.path.isfile(frame.payload_demod.path):
|
||||||
demod_to_db(frame.id)
|
sync_demoddata_to_db(frame.id)
|
||||||
except Exception:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ def export_station_status(self, request, queryset):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
def demod_to_db(frame_id):
|
def sync_demoddata_to_db(frame_id):
|
||||||
"""Task to send a frame from SatNOGS Network to SatNOGS DB"""
|
"""Task to send a frame from SatNOGS Network to SatNOGS DB"""
|
||||||
frame = DemodData.objects.get(id=frame_id)
|
frame = DemodData.objects.get(id=frame_id)
|
||||||
obs = frame.observation
|
obs = frame.observation
|
||||||
|
|
Loading…
Reference in New Issue