diff --git a/scos_actions/actions/acquire_sea_data_product.py b/scos_actions/actions/acquire_sea_data_product.py index 69d464fe..3409699a 100644 --- a/scos_actions/actions/acquire_sea_data_product.py +++ b/scos_actions/actions/acquire_sea_data_product.py @@ -34,6 +34,9 @@ from environs import Env from its_preselector import __version__ as PRESELECTOR_API_VERSION from scipy.signal import sos2tf, sosfilt + +from scos_actions import __version__ as SCOS_ACTIONS_VERSION +from scos_actions import utils from scos_actions.actions.interfaces.action import Action from scos_actions.hardware.sensor import Sensor from scos_actions.hardware.utils import ( @@ -73,9 +76,6 @@ from scos_actions.signals import measurement_action_completed, trigger_api_restart from scos_actions.utils import convert_datetime_to_millisecond_iso_format, get_days_up -from scos_actions import __version__ as SCOS_ACTIONS_VERSION -from scos_actions import utils - env = Env() logger = logging.getLogger(__name__) @@ -766,7 +766,7 @@ def capture_diagnostics( except: logger.warning("Failed to get SCOS start time") try: # SCOS uptime - cpu_diag["software_uptime"] = get_days_up() + cpu_diag["software_uptime"] = get_days_up(self.sensor.start_time) except: logger.warning("Failed to get SCOS uptime") try: # SSD SMART data diff --git a/scos_actions/discover/__init__.py b/scos_actions/discover/__init__.py index f02962c3..84ba8e6e 100644 --- a/scos_actions/discover/__init__.py +++ b/scos_actions/discover/__init__.py @@ -3,15 +3,8 @@ from scos_actions.actions.monitor_sigan import MonitorSignalAnalyzer from scos_actions.actions.sync_gps import SyncGps from scos_actions.discover.yaml import load_from_yaml -from scos_actions.hardware.mocks.mock_gps import MockGPS -from scos_actions.hardware.mocks.mock_sigan import MockSignalAnalyzer -from scos_actions.settings import ACTION_DEFINITIONS_DIR, MOCK_SIGAN -from scos_actions.signals import register_component_with_status +from scos_actions.settings import ACTION_DEFINITIONS_DIR -mock_sigan = MockSignalAnalyzer(randomize_values=True) -mock_gps = MockGPS() -if MOCK_SIGAN: - register_component_with_status.send(mock_sigan.__class__, component=mock_sigan) actions = {"logger": Logger()} test_actions = { "test_sync_gps": SyncGps(parameters={"name": "test_sync_gps"}), diff --git a/scos_actions/hardware/sensor.py b/scos_actions/hardware/sensor.py index 36fe0ca6..c5adb9bb 100644 --- a/scos_actions/hardware/sensor.py +++ b/scos_actions/hardware/sensor.py @@ -1,6 +1,6 @@ import hashlib import json -from datetime import datetime +import datetime from typing import Dict from its_preselector.preselector import Preselector @@ -28,7 +28,7 @@ def __init__( self._switches = switches self._location = location self.capabilities = capabilities - self.start_time = datetime.datetime.utcnow() + self_start_time = datetime.datetime.utcnow() @property def signal_analyzer(self) -> SignalAnalyzerInterface: @@ -103,4 +103,4 @@ def has_configurable_preselector(self) -> bool: @property def start_time(self): - return self.start_time + return self._start_time diff --git a/scos_actions/utils.py b/scos_actions/utils.py index 0fc5a73e..e70a4324 100644 --- a/scos_actions/utils.py +++ b/scos_actions/utils.py @@ -5,8 +5,6 @@ from dateutil import parser -from scos_actions.status import start_time - logger = logging.getLogger(__name__) @@ -121,7 +119,7 @@ def get_parameter(p: str, params: dict): return params[p] -def get_days_up(): +def get_days_up(start_time): elapsed = datetime.utcnow() - start_time days = elapsed.days fractional_day = elapsed.seconds / (60 * 60 * 24)