Skip to content

Add S2 scene caching for faster downloads#61

Draft
avis-giri wants to merge 3 commits into
mainfrom
feature/s2-scene-caching
Draft

Add S2 scene caching for faster downloads#61
avis-giri wants to merge 3 commits into
mainfrom
feature/s2-scene-caching

Conversation

@avis-giri

Copy link
Copy Markdown
Collaborator
  • Created cache_service.py with caching logic
  • Modified pipeline.py to check cache before S3 download
  • Year-based cache organization (data/cache/scenes/{year}/)
  • Cache only dual-window scenarios

Addresses #17

- Created cache_service.py with caching logic
- Modified pipeline.py to check cache before S3 download
- Year-based cache organization (data/cache/scenes/{year}/)
- Cache only dual-window scenarios

Addresses #17
@avis-giri avis-giri requested a review from asmithml November 5, 2025 20:43
Comment thread server/app/ml/pipeline.py
Comment on lines +31 to +45
# Check cache first (only for dual window scenarios)
if win_b is not None:
cached, cached_path = await check_s2_scene_exists(win_a, win_b, bbox)

if cached and cached_path is not None:
logger.info("Using cached S2 scene", extra=context)
shutil.copy2(cached_path, image_file)
download_time = round((time.time() - download_start) * 1000, 2)
image_size_mb = round(image_file.stat().st_size / (1024 * 1024), 2)

return {
"download_time_ms": download_time,
"image_size_mb": image_size_mb,
"from_cache": True,
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like there is a way to cache single windows. We want to cache the individual files, and then call them if they are needed. It should work for models that only need a single window, as well as models with two windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants