mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-09-05 08:06:15 +00:00
fix: skip dependency bindings in status memory walk (#510)
* fix: skip dependency bindings in status memory walk * chore: bump version to 0.4.1.11
This commit is contained in:
parent
bec7e48772
commit
65cb4ebdd6
3 changed files with 17 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
"""ReMe CLI package."""
|
||||
|
||||
__version__ = "0.4.1.10"
|
||||
__version__ = "0.4.1.11"
|
||||
|
||||
from . import config
|
||||
from . import constants
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import psutil
|
|||
|
||||
from ..base_step import BaseStep
|
||||
from ...components import BaseComponent, R
|
||||
from ...components.base_component import Dependency
|
||||
from ...enumeration import ComponentEnum
|
||||
|
||||
_SKIPPED_COMPONENT_ATTRIBUTES = {"app_context", "logger"}
|
||||
|
|
@ -48,6 +49,8 @@ def _component_size(obj: object) -> int:
|
|||
|
||||
if isinstance(value, BaseComponent) and value_id != root_id:
|
||||
return 0
|
||||
if isinstance(value, Dependency):
|
||||
return 0
|
||||
if isinstance(value, (type, ModuleType)):
|
||||
return 0
|
||||
if isinstance(value, np.ndarray):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import asyncio
|
||||
|
||||
from reme.components.application_context import ApplicationContext
|
||||
from reme.components.base_component import BaseComponent
|
||||
from reme.components.base_component import BaseComponent, Dependency
|
||||
from reme.enumeration import ComponentEnum
|
||||
from reme.steps.common.status import (
|
||||
StatusStep,
|
||||
|
|
@ -35,6 +35,18 @@ def test_component_size_does_not_charge_referenced_components_twice():
|
|||
assert dependency_size > owner_size
|
||||
|
||||
|
||||
def test_component_size_ignores_preserved_dependency_bindings():
|
||||
"""Resolved components retain dependency specs for live replacement."""
|
||||
component = _SizedComponent(b"payload")
|
||||
component._binding_specs["as_embedding"] = Dependency( # pylint: disable=protected-access
|
||||
ComponentEnum.AS_EMBEDDING,
|
||||
"default",
|
||||
)
|
||||
component._is_started = True # pylint: disable=protected-access
|
||||
|
||||
assert _component_size(component) > 0
|
||||
|
||||
|
||||
def test_collect_memory_reports_only_stateful_data_components_and_sum(tmp_path):
|
||||
"""Status includes only the data components whose state can grow."""
|
||||
context = ApplicationContext(workspace_dir=str(tmp_path))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue