Skip to content

Commit

Permalink
couple improvements to Flow
Browse files Browse the repository at this point in the history
  • Loading branch information
DinisCruz committed Feb 10, 2025
1 parent e902343 commit 4a3a75f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion osbot_utils/helpers/flows/Flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def set_flow_run_params(self, flow_run_params=None):
self.log_info(f"flow_run_params: {flow_run_params}")
self.add_flow_artifact(description="Data received via FastAPI's request.json()", key='post-data', data=flow_run_params)

def main(self): # method to be overwritten by implementing classes
def main(self, *args, **kwargs): # method to be overwritten by implementing classes
pass

def setup(self, target=None, *args, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions osbot_utils/helpers/flows/Task.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def execute__after(self):
if self.task_error:
self.log_error(f_red(f"Error executing '{self.task_name}' task: {self.task_error}"))
if self.raise_on_error:
raise Exception(f"'{self.task_name}' failed and task raise_on_error was set to True. Stopping flow execution")
raise Exception(f"'{self.task_name}' failed and task raise_on_error was set to True. Stopping flow execution", self.task_error)

self.print_task_finished_message()

Expand All @@ -116,7 +116,7 @@ def find_flow(self):
for frame_info in stack:
frame = frame_info.frame
for var_name, var_value in list(frame.f_locals.items()): # Check all local variables in the frame
if type(var_value) is Flow:
if isinstance(var_value, Flow):
return var_value
return None

Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/utils/Objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def serialize_to_dict(obj):
from enum import Enum
from typing import List

if isinstance(obj, (str, int, float, bool, bytes, Decimal)) or obj is None:
if isinstance(obj, (str, int, float, bool, bytes, Decimal)) or obj is None: # todo: add support for objects like datetime
return obj
elif isinstance(obj, Enum):
return obj.name
Expand Down

0 comments on commit 4a3a75f

Please sign in to comment.