Skip to content

Commit

Permalink
chore: good nits
Browse files Browse the repository at this point in the history
  • Loading branch information
joshc-slac committed Nov 8, 2024
1 parent be5eebd commit f0bfe76
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion beams/behavior_tree/ActionNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

import py_trees

from beams.behavior_tree.ActionWorker import ActionWorker, wrapped_action_work # the latter is grabbed as a pas through
from beams.behavior_tree.ActionWorker import wrapped_action_work # noqa: F401
from beams.behavior_tree.ActionWorker import ActionWorker
from beams.behavior_tree.VolatileStatus import VolatileStatus
from beams.typing_helper import ActionNodeWorkLoop, Evaluatable

Expand Down
12 changes: 5 additions & 7 deletions beams/behavior_tree/ActionWorker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@
"""
import logging
import time
from multiprocessing import Event, Value, Queue
from multiprocessing import Event, Queue, Value
from typing import Callable, Optional

from epics.multiproc import CAProcess

import py_trees
from epics.multiproc import CAProcess

from beams.behavior_tree.VolatileStatus import VolatileStatus
from beams.logging import LOGGER_QUEUE, worker_logging_configurer
from beams.sequencer.helpers.Timer import Timer
from beams.sequencer.helpers.Worker import Worker
from beams.typing_helper import (ActionNodeWorkFunction, ActionNodeWorkLoop,
Evaluatable)
from beams.sequencer.helpers.Worker import Worker
from beams.sequencer.helpers.Timer import Timer

logger = logging.getLogger(__name__)

Expand All @@ -51,8 +50,7 @@ def work_wrapper(
log_configurer(log_queue)
work_loop_timeout_timer = Timer(name=name,
timer_period_seconds=work_function_timeout_period_sec,
auto_start=False,
is_periodic=True)
auto_start=False)
while (do_work.value):
logger.debug(f"WAITING FOR INIT from node: {name}")
work_gate.wait()
Expand Down
6 changes: 3 additions & 3 deletions beams/sequencer/helpers/Timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

class Timer():
def __init__(self,
name: str,
name: str,
timer_period_seconds: float,
auto_start: bool = False,
auto_start: bool = False,
is_periodic: bool = False):
self.name = name
self.timer_period_seconds = timer_period_seconds
self.is_periodic = is_periodic
self.auto_start = auto_start
if (self.auto_start):
self.timer_start_time = time.time()
self.timer_start_time = time.monotonic()
else:
self.timer_start_time = -1

Expand Down
2 changes: 2 additions & 0 deletions beams/tests/test_timer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import time

import pytest

from beams.sequencer.helpers.Timer import Timer


Expand Down

0 comments on commit f0bfe76

Please sign in to comment.