Skip to content

Conversation

@PythonFZ
Copy link
Member

@PythonFZ PythonFZ commented Dec 5, 2024

https://github.com/zincware/ZnFlow/blob/d1e6f5ddc75cf2849f546d9afd08ef271f843544/znflow/graph.py#L125

causes all the getters to fire and try to get the values. This would be okay if they were not trying to all read from file

@codecov
Copy link

codecov bot commented Mar 31, 2025

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
210 2 208 29
View the top 2 failed test(s) by shortest run time
tests/unit_tests/test_repr.py::test_repr
Stack Traces | 0.127s run time
self = <[NameError("name 'NodeStatusEnum' is not defined") raised in repr()] WriteDVCOuts object at 0x7f6d5c9711c0>
name = 'nwd'

    def __getattribute__(self, name: str) -> Any:
        """Overrides the default behavior of attribute access.
    
        Allow for custom getter functionality defined via field metadata.
    
        Raises
        ------
        TypeError: If the class is not a dataclass.
        """
        if name.startswith("__") and name.endswith("__"):
            return super().__getattribute__(name)
        if not dataclasses.is_dataclass(self):
            raise TypeError(f"{self} is not a dataclass")
        try:
>           field = next(
                field for field in dataclasses.fields(self) if field.name == name
            )
E           StopIteration

.../ZnTrack/ZnTrack/.venv/lib/python3.12........./site-packages/znfields/__init__.py:51: StopIteration

During handling of the above exception, another exception occurred:

node = <[NameError("name 'NodeStatusEnum' is not defined") raised in repr()] WriteDVCOuts object at 0x7f6d5c9711c0>

    def get_nwd(node: "Node") -> pathlib.Path:
        """Get the node working directory.
    
        Arguments:
        ---------
        node: Node
            The node instance for which the nwd should be returned.
        """
        try:
>           return node.__dict__["nwd"]
E           KeyError: 'nwd'

.../zntrack/utils/node_wd.py:48: KeyError

During handling of the above exception, another exception occurred:

proj_path = PosixPath('.../pytest-of-runner/pytest-0/test_repr0')

    def test_repr(proj_path):
        assert (
            repr(zntrack.examples.ParamsToOuts(params=42))
            == "ParamsToOuts(name='ParamsToOuts', params=42)"
        )
>       assert repr(zntrack.examples.WriteDVCOuts(params=42)) == (
            "WriteDVCOuts(name='WriteDVCOuts', params=42,"
            " outs=PosixPath('nodes/WriteDVCOuts/output.txt'))"
        )

.../tests/unit_tests/test_repr.py:16: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../usr/lib/python3.12/dataclasses.py:262: in wrapper
    result = user_function(self)
<string>:3: in __repr__
    ???
.../ZnTrack/ZnTrack/.venv/lib/python3.12....../site-packages/znflow/node.py:87: in __getattribute__
    return super().__getattribute__(item)
.../ZnTrack/ZnTrack/.venv/lib/python3.12........./site-packages/znfields/__init__.py:58: in __getattribute__
    return lazy(self, name)
.../zntrack/plugins/base.py:27: in plugin_getter
    getter_value = plugin.getter(field)
.../plugins/dvc_plugin/__init__.py:45: in getter
    return getter(self.node, field.name)
.../zntrack/fields/x_path.py:40: in _paths_getter
    return nwd_handler(self.__dict__[name], nwd=self.nwd)
.../ZnTrack/ZnTrack/.venv/lib/python3.12....../site-packages/znflow/node.py:87: in __getattribute__
    return super().__getattribute__(item)
.../ZnTrack/ZnTrack/.venv/lib/python3.12........./site-packages/znfields/__init__.py:55: in __getattribute__
    return super().__getattribute__(name)
.../ZnTrack/zntrack/node.py:175: in nwd
    return self.state.nwd
.../ZnTrack/zntrack/state.py:91: in nwd
    self.node.__dict__["nwd"] = get_nwd(self.node)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

node = <[NameError("name 'NodeStatusEnum' is not defined") raised in repr()] WriteDVCOuts object at 0x7f6d5c9711c0>

    def get_nwd(node: "Node") -> pathlib.Path:
        """Get the node working directory.
    
        Arguments:
        ---------
        node: Node
            The node instance for which the nwd should be returned.
        """
        try:
            return node.__dict__["nwd"]
        except KeyError:
            if node.name is None:
                raise ValueError("Unable to determine node name.")
            if (
                node.state.remote is None
                and node.state.rev is None
>               and node.state.state != NodeStatusEnum.FINISHED
            ):
E           NameError: name 'NodeStatusEnum' is not defined

.../zntrack/utils/node_wd.py:55: NameError
tests/unit_tests/test_node_nwd.py::test_no_node_name
Stack Traces | 0.532s run time
self = Node(name='Node'), name = 'nwd'

    def __getattribute__(self, name: str) -> Any:
        """Overrides the default behavior of attribute access.
    
        Allow for custom getter functionality defined via field metadata.
    
        Raises
        ------
        TypeError: If the class is not a dataclass.
        """
        if name.startswith("__") and name.endswith("__"):
            return super().__getattribute__(name)
        if not dataclasses.is_dataclass(self):
            raise TypeError(f"{self} is not a dataclass")
        try:
>           field = next(
                field for field in dataclasses.fields(self) if field.name == name
            )
E           StopIteration

.../ZnTrack/ZnTrack/.venv/lib/python3.12....../site-packages/znfields/__init__.py:51: StopIteration

During handling of the above exception, another exception occurred:

node = Node(name='Node')

    def get_nwd(node: "Node") -> pathlib.Path:
        """Get the node working directory.
    
        Arguments:
        ---------
        node: Node
            The node instance for which the nwd should be returned.
        """
        try:
>           return node.__dict__["nwd"]
E           KeyError: 'nwd'

.../zntrack/utils/node_wd.py:48: KeyError

During handling of the above exception, another exception occurred:

proj_path = PosixPath('.../pytest-of-runner/pytest-0/test_no_node_name0')

    def test_no_node_name(proj_path):
>       assert zntrack.Node().nwd == pathlib.Path("nodes", "Node")

.../tests/unit_tests/test_node_nwd.py:19: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../ZnTrack/ZnTrack/.venv/lib/python3.12.../site-packages/znflow/node.py:87: in __getattribute__
    return super().__getattribute__(item)
.../ZnTrack/ZnTrack/.venv/lib/python3.12....../site-packages/znfields/__init__.py:55: in __getattribute__
    return super().__getattribute__(name)
.../ZnTrack/zntrack/node.py:175: in nwd
    return self.state.nwd
.../ZnTrack/zntrack/state.py:91: in nwd
    self.node.__dict__["nwd"] = get_nwd(self.node)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

node = Node(name='Node')

    def get_nwd(node: "Node") -> pathlib.Path:
        """Get the node working directory.
    
        Arguments:
        ---------
        node: Node
            The node instance for which the nwd should be returned.
        """
        try:
            return node.__dict__["nwd"]
        except KeyError:
            if node.name is None:
                raise ValueError("Unable to determine node name.")
            if (
                node.state.remote is None
                and node.state.rev is None
>               and node.state.state != NodeStatusEnum.FINISHED
            ):
E           NameError: name 'NodeStatusEnum' is not defined

.../zntrack/utils/node_wd.py:55: NameError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@github-actions
Copy link

github-actions bot commented Mar 31, 2025

Benchmark

Write: Varying number of nodes

Write: Varying number of edges

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.

2 participants