Skip to content

[action.Node] have the name as a property #492

@caioaamaral

Description

@caioaamaral

Description

Have action.Node to expose the self.__node_name attribute as a property:

Motivation

I want to have access to the Node's name as a property to be able to filter a specific node from a container:

def find_node_by_name(name: str, nodes: list[Node]):
    return next((node for node in nodes if node.name == name), None)

NODES = [
  Node(name='foo'),
  Node(name='bar'),
  Node(name='zaz'),
]

def __name__ == '__main__':
    foo_node = find_node_by_name('foo', NODES)

Design / Implementation Considerations

@expose_action('node')
class Node(ExecuteProcess):
...

    @property
    def name(self):
        """Getter for name."""
        return self.__node_name

if it is an issue overriding ExecuteProcess.name property we can expose the property as node_name instead:

@property
def node_name(self):
    """Getter for name."""
    return self.__node_name

### Additional Information

_No response_

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions