Skip to content

Commit

Permalink
enh: resetting feature flag of heartbeat count on successful reset so…
Browse files Browse the repository at this point in the history
… if this node gets triggered twice itll recache heartbeat
  • Loading branch information
joshc-slac committed Dec 11, 2024
1 parent 370006f commit 395f274
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion beams/tree_config/utility_trees/reset_ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,18 @@ def cache_hbeat_wfunc(comp_condition: Evaluatable) -> py_trees.common.Status:
loop_period_sec=0.1, # this is greater than work_timeout period, should only happen once.
termination_check=reset_success_termination_condiiton)

# get the current heartbeat of IOC
@wrapped_action_work(loop_period_sec=0.1)
def reset_cache_hbeat_wfunc(comp_condition: Evaluatable) -> py_trees.common.Status:
self.hbeat_val.set_value(-1)
logger.debug(f"<<-- Resetting cached ioc hbeat for tree: {self.ioc_prefix}")

return py_trees.common.Status.SUCCESS
reset_heartbeat_cache = ActionNode(name=f"{self.ioc_prefix}_reset_heartbeat_cache",
work_func=reset_cache_hbeat_wfunc,
completion_condition=lambda : self.hbeat_val.get_value() == -1)

root = Sequence(name=self.name,
memory=True,
children=[cache_current_heartbeat, send_reset.get_tree()])
children=[cache_current_heartbeat, send_reset.get_tree(), reset_heartbeat_cache])
return root

0 comments on commit 395f274

Please sign in to comment.