Skip to content
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

refactor: csv loader code implementation #4529

Merged
merged 2 commits into from
Jan 7, 2025
Merged

Conversation

AfaqShuaib09
Copy link
Contributor

@AfaqShuaib09 AfaqShuaib09 commented Dec 31, 2024

PROD-4238

This PR refactors the CSV loader code to improve readability, making it cleaner and easier to follow.

@AfaqShuaib09 AfaqShuaib09 force-pushed the afaq/prod-4238 branch 3 times, most recently from a2949c8 to a32c714 Compare January 1, 2025 17:35
@AfaqShuaib09 AfaqShuaib09 marked this pull request as ready for review January 2, 2025 07:40
@@ -438,6 +453,16 @@ def _log_ingestion_error(self, error_code, message):
logger.error(message)
self._register_ingestion_error(error_code, message)

@classmethod
def clear_caches(cls):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to clear the caches?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because functools caches are global caches instead of instance-level caches, I believe it's better to clear the caches after a job has been completed. If we don't do that, we would need to explicitly clear them in testsuites.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the only usage is in the tests, maybe add a comment indicating that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's kind of used for tests as well, it's better to clear all the method-level caches after the execution of the job therefore I called this at the end of ingest method

@@ -438,6 +453,16 @@ def _log_ingestion_error(self, error_code, message):
logger.error(message)
self._register_ingestion_error(error_code, message)

@classmethod
def clear_caches(cls):
Copy link
Contributor

Choose a reason for hiding this comment

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

If the only usage is in the tests, maybe add a comment indicating that.

@AfaqShuaib09 AfaqShuaib09 merged commit 3bae84c into master Jan 7, 2025
13 of 14 checks passed
@AfaqShuaib09 AfaqShuaib09 deleted the afaq/prod-4238 branch January 7, 2025 09:55
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