Skip to content

Conversation

@mikesmit
Copy link
Collaborator

Related to PolicyEngine/issues#350

this change re-implements the download_file_from_gcs function to use CachingGoogleStorageClient.

Files should now be cached locally on a per-process basis and only updated on disk when the remote version crc changes.

@mikesmit mikesmit force-pushed the 350_use_caching_google_storage_client branch from e621eda to b0a17e1 Compare May 15, 2025 22:11
@mikesmit mikesmit marked this pull request as ready for review May 15, 2025 22:16
Copy link
Contributor

@anth-volk anth-volk left a comment

Choose a reason for hiding this comment

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

Per discussion with @mikesmit, due to lack of integration testing capabilities and the fact that the v2 service is not used by customers, we will merge and roll back on off chance that file downloads are misconfigured.

@mikesmit mikesmit force-pushed the 350_use_caching_google_storage_client branch from b0a17e1 to 3e01076 Compare May 15, 2025 22:56
@@ -1,3 +1,26 @@
from .data.caching_google_storage_client import CachingGoogleStorageClient
Copy link
Contributor

Choose a reason for hiding this comment

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

issue, blocking: Add a changelog entry

Without it, this package won't launch to PyPI, and there's no check for changelog_entry.yaml in the GH Actions

def _get_client():
global _caching_client
if _caching_client is not None:
print("Caching client already created")
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Is there an advantage to printing over using the logging package?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh that was me debugging. Will remove this and the other one.

if _caching_client is not None:
print("Caching client already created")
return _caching_client
print("Creating caching client")
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Here, too, would it be better to log?

Copy link
Contributor

@anth-volk anth-volk left a comment

Choose a reason for hiding this comment

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

A couple minor questions and one blocking issue: a changelog_entry.yaml file is needed to trigger PyPI deployment

Related to PolicyEngine/issues#350

this change re-implements the download_file_from_gcs function to use CachingGoogleStorageClient.

Files should now be cached locally on a per-process basis and only updated on disk when the remote version crc changes.
@mikesmit mikesmit force-pushed the 350_use_caching_google_storage_client branch from 3e01076 to 566a067 Compare May 15, 2025 23:06
@mikesmit mikesmit merged commit df9d647 into main May 16, 2025
3 checks passed
mikesmit pushed a commit that referenced this pull request May 19, 2025
…gle_storage_client"

This reverts commit df9d647, reversing
changes made to 9ca329c.

related to #PolicyEngine/issues#350

This change resulted in an asyncio error because fastAPI calls from an event loop and you can't run asyncio.run if already in an event loop
mikesmit pushed a commit that referenced this pull request May 19, 2025
…gle_storage_client"

This reverts commit df9d647, reversing
changes made to 9ca329c.

related to #PolicyEngine/issues#350

This change resulted in an asyncio error because fastAPI calls from an event loop and you can't run asyncio.run if already in an event loop
mikesmit added a commit that referenced this pull request May 19, 2025
Revert "Merge pull request #133 from PolicyEngine/350_use_caching_goo…
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.

3 participants