Skip to content

Commit 80e9204

Browse files
committed
cleaned Node Creation logic
1 parent 76a002c commit 80e9204

3 files changed

Lines changed: 146 additions & 137 deletions

File tree

python-sdk/exospherehost/node/BaseNode.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,15 @@ class Outputs(BaseModel):
4646
"""
4747
pass
4848

49+
async def _execute(self, inputs: Inputs) -> Outputs | List[Outputs]:
50+
"""
51+
Execute the node's main logic.
52+
"""
53+
self.inputs = inputs
54+
return await self.execute()
55+
4956
@abstractmethod
50-
async def execute(self, inputs: Inputs) -> Outputs | List[Outputs]:
57+
async def execute(self) -> Outputs | List[Outputs]:
5158
"""
5259
Execute the node's main logic.
5360
@@ -68,18 +75,4 @@ async def execute(self, inputs: Inputs) -> Outputs | List[Outputs]:
6875
Exception: Any exception that occurs during execution will be caught
6976
by the Runtime and reported as an error state.
7077
"""
71-
pass
72-
73-
def get_unique_name(self) -> str:
74-
"""
75-
Get the unique name for this node instance.
76-
77-
Returns the unique_name if it was provided during initialization,
78-
otherwise returns the class name.
79-
80-
Returns:
81-
str: The unique identifier for this node instance
82-
"""
83-
if self.unique_name is not None:
84-
return self.unique_name
85-
return self.__class__.__name__
78+
raise NotImplementedError("execute method must be implemented by all concrete node classes")

0 commit comments

Comments
 (0)