Skip to content

Commit

Permalink
mg gsc custom gsc rename func arg
Browse files Browse the repository at this point in the history
  • Loading branch information
kmantel committed Oct 25, 2023
1 parent 653f17f commit adb7638
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/graph_scheduler/condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -2777,26 +2777,26 @@ def _actions_names_max_length(cls):

class CustomGraphStructureCondition(GraphStructureCondition):
def __init__(
self, custom_process: typing.Callable[[dict], dict], *nodes, **kwargs
self, process_graph_function: typing.Callable[[dict], dict], *nodes, **kwargs
):
self.custom_process = custom_process
self.process_graph_function = process_graph_function
super().__init__(*nodes, **kwargs)

def __str__(self):
return self._make_str({"custom_process": self.custom_process})
return self._make_str({"process_graph_function": self.process_graph_function})

def _process(self, graph: dict) -> dict:
graph = super()._process(graph)

sig = inspect.signature(self.custom_process)
sig = inspect.signature(self.process_graph_function)
if 'self' in sig.parameters:
if next(iter(sig.parameters)) != 'self':
raise ConditionError(
"If using 'self' in custom_process, it must be the first argument"
"If using 'self' in process_graph_function, it must be the first argument"
)
return self.custom_process(self, graph)
return self.process_graph_function(self, graph)
else:
return self.custom_process(graph)
return self.process_graph_function(graph)


class GSCReposition(GraphStructureCondition):
Expand Down

0 comments on commit adb7638

Please sign in to comment.