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

Enhance Managed_Resource to allow implementation of in-memory caches #11577

Merged
merged 29 commits into from
Dec 3, 2024

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Nov 18, 2024

Pull Request Description

Allows connection between refresh button and caches as requested by #11485:

  • please use Managed_Resource.new system_resource=True to create a reference that "can disappear"
  • please call EnsoContext.getResourceManager().scheduleFinalization() to clear the caches when the refresh button is pressed

ResourceManager provides scheduleFinalization method that allows cleanup of "system managed" references

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • All code follows the
    Scala,
    Java,
  • Unit tests have been written where possible.

@JaroslavTulach JaroslavTulach added the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Nov 18, 2024
@JaroslavTulach JaroslavTulach self-assigned this Nov 18, 2024
@jdunkerley
Copy link
Member

jdunkerley commented Nov 18, 2024

How do we create a "static" instance of one of these?

Guess we just put one into Java as usual.

@JaroslavTulach JaroslavTulach changed the title Using Ref.new allow_gc=True to implement in-memory caches Using Ref.new allow_gc=True to implement in-memory caches Nov 18, 2024
Copy link
Member

@Akirathan Akirathan left a comment

Choose a reason for hiding this comment

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

Interesting idea. LGTM. I am a bit afraid about transient failures in the RefTest.

@GregoryTravis
Copy link
Contributor

@JaroslavTulach I'll get this connected to my cache and write a test for it.

@JaroslavTulach JaroslavTulach changed the title Using Ref.new allow_gc=True to implement in-memory caches Enhance Managed_Resource to allow implementation of in-memory caches Nov 28, 2024
Copy link
Member

@radeusgd radeusgd left a comment

Choose a reason for hiding this comment

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

Looks good but I'd change the default on_missing to something more 'visible' than Nothing. We are having plenty of issues caused by accidentally discarding errors, so it's better if we program more 'defensively' against this.

Copy link
Member

@Akirathan Akirathan left a comment

Choose a reason for hiding this comment

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

LGTM. I have created #11714 to potentially remove now even more deprecated AutomaticParallelism IR pass and Name.Special IR elements.

Co-authored-by: Radosław Waśko <[email protected]>
@JaroslavTulach JaroslavTulach force-pushed the wip/jtulach/ReferenceManager11485 branch from 05c3812 to a1f7e6f Compare December 2, 2024 04:17
@JaroslavTulach JaroslavTulach merged commit d687365 into develop Dec 3, 2024
42 checks passed
@JaroslavTulach JaroslavTulach deleted the wip/jtulach/ReferenceManager11485 branch December 3, 2024 14:13
jdunkerley pushed a commit that referenced this pull request Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refresh button should clear HTTP cache
7 participants