Skip to content

Commit 869a94f

Browse files
committed
Added debugging method to the handler
1 parent 87a0a62 commit 869a94f

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

ingest/handler.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,14 @@ def cronhandler(event, context):
114114
pipeline_limit = settings.PIPELINE_LIMIT if 'pipeline_limit' not in event else event['pipeline_limit']
115115
realtime_limit = settings.REALTIME_LIMIT if 'realtime_limit' not in event else event['realtime_limit']
116116
metadata_limit = settings.METADATA_LIMIT if 'metadata_limit' not in event else event['metadata_limit']
117+
fetchlogKey = event.get('fetchlogKey')
117118

118-
logger.info(f"Running cron job: {event['source']}, ascending: {ascending}")
119+
# this is mostly for debuging and running the occasional file from the aws console
120+
if fetchlogKey is not None:
121+
limit = event.get('limit', 10)
122+
return load_measurements_db(limit=limit, ascending=True, pattern=fetchlogKey)
119123

124+
logger.info(f"Running cron job: {event['source']}, ascending: {ascending}")
120125
# these exceptions are just a failsafe so that if something
121126
# unaccounted for happens we can still move on to the next
122127
# process. In case of this type of exception we will need to

local.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,22 @@
4141
client = IngestClient()
4242
## load all the data into the client
4343
client.load_keys([
44-
[1, '~/Downloads/openaq-fetches/lcs-etl-pipeline/measures/lovemyair/2024-11-12/1731445632-1snpf.json', '2024-10-23']
44+
# [1, '~/Downloads/openaq-fetches/lcs-etl-pipeline/measures/airgradient/2025-02-14/1739542053-5n5q.json', '2024-10-23']
45+
# [1, '/home/christian/Downloads/1739444861-6bvu.json', '2025-02-13']
46+
[7786652, 'lcs-etl-pipeline/measures/airgradient/2025-02-14/1739549254-h5b0m.json.gz', '2025-02-14']
4547
])
4648

4749
## dump just the locations
48-
client.dump()
50+
#client.dump()
4951

5052
# rollups and cached tables
5153
#client.process_hourly_data()
5254
#client.process_daily_data()
5355
#client.process_annual_data()
5456
#client.refresh_cached_tables()
5557

56-
#client.dump_locations(False)
57-
#client.dump_measurements(load=False)
58+
client.dump_locations()
59+
client.dump_measurements(load=True)
5860
## dump just the measurements
5961
# client.dump_measurements
6062
## Dump both

0 commit comments

Comments
 (0)