This commit is contained in:
Cyberes 2024-09-03 17:11:22 -06:00
parent 33dae67940
commit 36e5d96e7a
2 changed files with 6 additions and 6 deletions

View File

@ -3,7 +3,6 @@ import logging
import pickle import pickle
import time import time
from datetime import datetime from datetime import datetime
from typing import List
import schedule import schedule
from PIL import Image from PIL import Image
@ -25,10 +24,11 @@ def main():
utc_hr = datetime.utcnow().hour utc_hr = datetime.utcnow().hour
logging.info(f'Generating plot for hour {utc_hr}') logging.info(f'Generating plot for hour {utc_hr}')
ionex_data: List = pickle.loads(redis.get('tecmap_data')) data = redis.get('tecmap_data')
while ionex_data is None: while data is None:
logging.warning('Redis has not been populated yet. Is cache.py running? Sleeping 10s...') logging.warning('Redis has not been populated yet. Is cache.py running? Sleeping 10s...')
time.sleep(10) time.sleep(10)
ionex_data = pickle.loads(data)
for tecmap, epoch in ionex_data: for tecmap, epoch in ionex_data:
if epoch.hour == utc_hr: if epoch.hour == utc_hr:

View File

@ -4,7 +4,6 @@ import pickle
import sys import sys
import time import time
from datetime import datetime from datetime import datetime
from typing import List
import numpy as np import numpy as np
import paho.mqtt.client as mqtt import paho.mqtt.client as mqtt
@ -67,10 +66,11 @@ def main():
logging.info('Fetching latest IONEX data') logging.info('Fetching latest IONEX data')
logging.info(f'Using hour {utc_hr}') logging.info(f'Using hour {utc_hr}')
ionex_data: List = pickle.loads(redis.get('tecmap_data')) data = redis.get('tecmap_data')
while ionex_data is None: while data is None:
logging.warning('Redis has not been populated yet. Is cache.py running? Sleeping 10s...') logging.warning('Redis has not been populated yet. Is cache.py running? Sleeping 10s...')
time.sleep(10) time.sleep(10)
ionex_data = pickle.loads(data)
avg_tec = None avg_tec = None
for tecmap, epoch in ionex_data: for tecmap, epoch in ionex_data: