Skip to content

Commit

Permalink
Fix with entry/exit behavior on no node type in jac cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
ypkang committed Oct 9, 2024
1 parent ceb2de2 commit 1dad42b
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions jac-cloud/jac_cloud/plugin/jaseci.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,15 @@ def spawn_call(op1: Architype, op2: Architype) -> WalkerArchitype:
walker.path = []
walker.next = [node]
walker.returns = []

if walker.next:
current_node = walker.next[-1].architype
for i in warch._jac_entry_funcs_:
if not i.trigger:
if i.func:
walker.returns.append(i.func(warch, current_node))
else:
raise ValueError(f"No function {i.name} to call.")
while len(walker.next):
if current_node := walker.next.pop(0).architype:
for i in current_node._jac_entry_funcs_:
Expand All @@ -730,16 +739,20 @@ def spawn_call(op1: Architype, op2: Architype) -> WalkerArchitype:
return warch
for i in warch._jac_entry_funcs_:
if not i.trigger or isinstance(current_node, i.trigger):
if i.func:
if i.func and i.trigger:
walker.returns.append(i.func(warch, current_node))
elif not i.trigger:
continue
else:
raise ValueError(f"No function {i.name} to call.")
if walker.disengaged:
return warch
for i in warch._jac_exit_funcs_:
if not i.trigger or isinstance(current_node, i.trigger):
if i.func:
if i.func and i.trigger:
walker.returns.append(i.func(warch, current_node))
elif not i.trigger:
continue
else:
raise ValueError(f"No function {i.name} to call.")
if walker.disengaged:
Expand All @@ -752,6 +765,12 @@ def spawn_call(op1: Architype, op2: Architype) -> WalkerArchitype:
raise ValueError(f"No function {i.name} to call.")
if walker.disengaged:
return warch
for i in warch._jac_exit_funcs_:
if not i.trigger:
if i.func:
walker.returns.append(i.func(warch, current_node))
else:
raise ValueError(f"No function {i.name} to call.")
walker.ignores = []
return warch

Expand Down

0 comments on commit 1dad42b

Please sign in to comment.