Skip to content

Conversation

@gpauloski
Copy link
Collaborator

Description

Improves the flexibility of the Lifetime protocol (a breaking change). Add the StaticLifetime singleton which evicts associated objects at the end of the program.

Fixes

Type of Change

  • Breaking Change (fix or enhancement which changes existing semantics of the public interface)
  • Enhancement (new features or improvements to existing functionality)
  • Bug (fixes for a bug or issue)
  • Internal (refactoring, style changes, testing, optimizations)
  • Documentation update (changes to documentation or examples)
  • Package (dependencies, versions, package metadata)
  • Development (CI workflows, pre-commit, linters, templates)
  • Security (security related changes)

Testing

Added new unit tests and used the following script with logging enabled to verify correctness.

import logging

from proxystore.connectors.local import LocalConnector
from proxystore.store import Store, register_store
from proxystore.store.lifetimes import StaticLifetime

logging.basicConfig(level=logging.DEBUG)

store = Store('default', LocalConnector())
register_store(store)
store.put('value', lifetime=StaticLifetime())
store.proxy('value', lifetime=StaticLifetime())
$ python example.py
INFO:proxystore.store.base:Initialized Store("default", connector=LocalConnector(), serializer=default, deserializer=default, cache_size=16, metrics=False)
INFO:proxystore.store:Registered a store named default
DEBUG:proxystore.store.lifetimes:Registered atexit callback for <proxystore.store.lifetimes.StaticLifetime object at 0x7f271dd2cc10>
DEBUG:proxystore.store.lifetimes:Added keys to lifetime manager (name=static): LocalKey(id='2220b8f9-e11c-486f-affe-181943b20722')
DEBUG:proxystore.store.base:Store(name="default"): PUT LocalKey(id='2220b8f9-e11c-486f-affe-181943b20722') in 0.039 ms
DEBUG:proxystore.store.base:Store(name="default"): PUT LocalKey(id='dc050b19-f12f-4da4-a611-52f0d63925b8') in 0.008 ms
DEBUG:proxystore.store.lifetimes:Added keys to lifetime manager (name=static): LocalKey(id='dc050b19-f12f-4da4-a611-52f0d63925b8')
DEBUG:proxystore.store.base:Store(name="default"): PROXY LocalKey(id='dc050b19-f12f-4da4-a611-52f0d63925b8') in 0.064 ms
DEBUG:proxystore.store.base:Store(name="default"): EVICT LocalKey(id='dc050b19-f12f-4da4-a611-52f0d63925b8') in 0.002 ms
DEBUG:proxystore.store.base:Store(name="default"): EVICT LocalKey(id='2220b8f9-e11c-486f-affe-181943b20722') in 0.002 ms
INFO:proxystore.store.lifetimes:Closed lifetime manager and evicted 2 associated objects (name=static)

Pull Request Checklist

Please confirm the PR meets the following requirements.

  • Tags added to PR (e.g., breaking, bug, enhancement, internal, documentation, package, development, security).
  • Code changes pass pre-commit (e.g., mypy, ruff, etc.).
  • Tests have been added to show the fix is effective or that the new feature works.
  • New and existing unit tests pass locally with the changes.
  • Docs have been updated and reviewed if relevant.

@gpauloski gpauloski added enhancement New features or improvements to existing functionality breaking Backwards incompatible change to public interfaces labels Apr 20, 2024
@gpauloski gpauloski merged commit 4a2f261 into main Apr 20, 2024
@gpauloski gpauloski deleted the issue-515 branch April 20, 2024 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Backwards incompatible change to public interfaces enhancement New features or improvements to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add StaticLifetime singleton

2 participants