-
Notifications
You must be signed in to change notification settings - Fork 0
added upload caching #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added upload caching #387
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,16 +9,32 @@ | |||||||||||
| from rapidata.service.openapi_service import OpenAPIService | ||||||||||||
| from rapidata.rapidata_client.config import logger | ||||||||||||
| from rapidata.rapidata_client.config import tracer | ||||||||||||
| from rapidata.rapidata_client.config import rapidata_config | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| class AssetUploader: | ||||||||||||
| def __init__(self, openapi_service: OpenAPIService): | ||||||||||||
| self.openapi_service = openapi_service | ||||||||||||
| self._upload_cache: dict[str, str] = {} | ||||||||||||
|
|
||||||||||||
| def _get_cache_key(self, asset: str) -> str: | ||||||||||||
| """Generate cache key for an asset.""" | ||||||||||||
| if re.match(r"^https?://", asset): | ||||||||||||
| return asset | ||||||||||||
| else: | ||||||||||||
| stat = os.stat(asset) | ||||||||||||
|
||||||||||||
| stat = os.stat(asset) | |
| try: | |
| stat = os.stat(asset) | |
| except FileNotFoundError: | |
| raise FileNotFoundError(f"File not found: {asset}") |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The debug log 'Asset added to cache' is always executed regardless of whether caching is enabled or the asset was actually added to cache. Move this log statement inside the if rapidata_config.upload.cache_uploads: block on line 50.
| logger.debug("Asset added to cache") | |
| logger.debug("Asset added to cache") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
cache_uploadsfield is not documented in the class docstring. Add documentation for this field explaining that it controls whether uploaded assets are cached to avoid duplicate uploads.