Feature/9086 task offload sites parquetduckdb refresh to aws batch to reduce api service memory usage - #275
Merged
Conversation
…9086-task-offload-sites-parquetduckdb-refresh-to-aws-batch-to-reduce-api-service-memory-usage
utas-raymondng
requested changes
Sep 8, 2026
utas-raymondng
left a comment
Contributor
There was a problem hiding this comment.
Please kindly review comments
| id="refresh_task", | ||
| name="Repository data refresh task", | ||
| self._reload_task, | ||
| trigger=CronTrigger(hour="*/2", minute="0"), # Every 2 hours, on the hour |
Contributor
There was a problem hiding this comment.
Is this the job of the batch scheduler rather than this app ?
| f""" | ||
| CREATE OR REPLACE TABLE {quote_ident(self.table)} AS | ||
| SELECT * FROM read_parquet('{self.backup_dataset}') | ||
| SELECT * FROM read_parquet('{self.snapshot_dataset}') |
Contributor
There was a problem hiding this comment.
You should do
db.execute("INSTALL httpfs; LOAD httpfs;")
in your duckdb client init if you want to read s3 fast.
Also please use, duckdb can use a few optimization method internally to speed up the query
f"""
CREATE OR REPLACE VIEW {quote_ident(self.table)} AS
SELECT * FROM read_parquet('{self.snapshot_dataset}')
"""
in case the speed is not fast enough with single file parquet you should consider using partition hive and generate the parquet with time partition
…to feature/9086-task-offload-sites-parquetduckdb-refresh-to-aws-batch-to-reduce-api-service-memory-usage
…_dataset to reduce memory usage
utas-raymondng
approved these changes
Sep 8, 2026
utas-raymondng
left a comment
Contributor
There was a problem hiding this comment.
There are few minor things that needs to address with another PR
| table = "test_mooring" | ||
| bucket = "test-bucket" | ||
| backup_bucket = "test-backup" | ||
| snapshot_bucket = "test-snapshot" |
Contributor
There was a problem hiding this comment.
If this is test only setting you should put it in config-dev.yaml or config-test.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Offload the heavy Parquet DuckDB load for mooring/wave-buoy sites data from the this project to batch job, so the service only does a cheap reload from an S3 snapshot instead of the full heavy read.