Skip to content

Commit

Permalink
bit of extra logging
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHodson committed Jan 21, 2025
1 parent 534b82a commit 2a0fefd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cron_ingest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cd /home/math/IonBeam
export ODC_ENABLE_WRITING_LONG_STRING_CODEC=1
echo >> cron_logs_ingest.txt
echo Meteotracker `date` >> cron_logs_ingest.txt
echo Ingestion `date` >> cron_logs_ingest.txt
/home/math/.venv/bin/python -m ionbeam \
./config -vvv \
--env ewc \
Expand Down
4 changes: 2 additions & 2 deletions src/ionbeam/sources/API_sources_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def __init__(self, retry_at: datetime | None = None,


else:
logger.debug("No Retry-After header, delaying for one minute.")
self.retry_at = datetime.now(UTC) + timedelta(minutes=1)
logger.debug("No Retry-After header, delaying for 5 minutes.")
self.retry_at = datetime.now(UTC) + timedelta(minutes=5)

@dataclasses.dataclass(eq=True, frozen=True)
class DataChunk:
Expand Down
4 changes: 4 additions & 0 deletions src/ionbeam/sources/smart_citizen_kit/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from ...core.bases import Mappings, RawVariable, TabularMessage, TimeSpan
from ..API_sources_base import DataChunk, DataStream, RESTSource
from ...singleprocess_pipeline import fmt_time
from time import sleep

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -214,6 +215,9 @@ def download_chunk(self, data_stream: DataStream, time_span: TimeSpan) -> DataCh

readings = self.get_readings(device_id, sensor["id"], time_span)

# Try to reduce how often we get rate limited by SCK
sleep(0.5)

# Skip if there are now readings
if not readings["readings"]:
logger.debug(f"No readings returned for {sensor['name']}, even though the date metadata suggested there should be.")
Expand Down

0 comments on commit 2a0fefd

Please sign in to comment.