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

skip cashing for exceptions #233

Merged
merged 6 commits into from
Oct 18, 2024
Merged

skip cashing for exceptions #233

merged 6 commits into from
Oct 18, 2024

Conversation

Borda
Copy link
Contributor

@Borda Borda commented Sep 19, 2024

resolves #215

some small cleaning and adding completed flag to the entry

@Borda Borda marked this pull request as ready for review September 19, 2024 12:18
@Borda Borda marked this pull request as draft September 19, 2024 12:29
@Borda
Copy link
Contributor Author

Borda commented Sep 19, 2024

@shaypal5, confused about what "being_calculated" stands for...

@shaypal5
Copy link
Collaborator

@shaypal5, confused about what "being_calculated" stands for...

For non-local cores, like MongoDB, and long calculations, and to allow cross-machine (basically cross-kernel) caching, this supports the case where the same code calls the same decorated function with the same arguments (lets say a=3, b=5) on two different kernels/machine, 1 second apart (for example), for a calculation that lasts 10 minutes.

The first calls create a new entry for the cache key derived for a=3, b=5, with being_calculated == True in the entry, then waits for the function to return (when it will return, it will cache the result in the existing entry and update being_calculated == False). After 1 second, the same decorated function will get called with the same arguments on some other machine; it will search the MongoDB and find out an entry already exists for this argument set, and will see being_calculated == True, and will thus wait for the existing calculation (function call) to finish without triggering a second (redundant) call to the wrapped function.

Kapich?

@Borda
Copy link
Contributor Author

Borda commented Oct 16, 2024

@shaypal5 made two dataclass refactoring #237 #239 to make my path to better understand the codebase 🦅

@Borda Borda marked this pull request as ready for review October 17, 2024 21:12
@Borda
Copy link
Contributor Author

Borda commented Oct 17, 2024

@shaypal5 seems to be fixed now if you could check it

Copy link
Collaborator

@shaypal5 shaypal5 left a comment

Choose a reason for hiding this comment

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

Great work, again!

@shaypal5 shaypal5 merged commit 67bcf72 into master Oct 18, 2024
33 checks passed
@shaypal5 shaypal5 deleted the fix/raise_exception branch October 18, 2024 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cachier caches a None return value when a function raises an Exception
2 participants