Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sea action health check #60

Merged
merged 6 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion scos_actions/actions/acquire_sea_data_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
convert_linear_to_dB,
convert_watts_to_dBm,
)
from scos_actions.signals import measurement_action_completed
from scos_actions.signals import measurement_action_completed, trigger_api_restart

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -570,6 +570,10 @@ def test_required_components(self):
if "SPU X410" not in [s.name for s in switches.values()]:
msg = "Configuration error: no switch configured with name 'SPU X410'"
raise RuntimeError(msg)
if not self.sigan.healthy():
trigger_api_restart.send(
sender=self.__class__
)
# TODO: Add additional health checks
return None

Expand Down
9 changes: 5 additions & 4 deletions scos_actions/actions/interfaces/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ def __init__(self, parameters, sigan, gps=None):
self.sigan = sigan
self.gps = gps
self.sensor_definition = capabilities["sensor"]
self.has_preselector = (
True if "preselector" in self.sensor_definition else False
)
if "preselector" in self.sensor_definition and "rf_paths" in self.sensor_definition["preselector"]:
self.has_configurable_preselector = True
else:
self.has_configurable_preselector = False

def configure(self, measurement_params: dict):
self.configure_sigan(measurement_params)
Expand All @@ -59,7 +60,7 @@ def configure_preselector(self, measurement_params: dict):
path = measurement_params[self.PRESELECTOR_PATH_KEY]
logger.debug(f"Setting preselector RF path: {path}")
preselector.set_state(path)
elif self.has_preselector:
elif self.has_configurable_preselector:
# Require the RF path to be specified if the sensor has a preselector.
raise ParameterException(
f"No {self.PRESELECTOR_PATH_KEY} value specified in the YAML config."
Expand Down
2 changes: 1 addition & 1 deletion scos_actions/metadata/sigmf_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def set_capture(
"core:datetime": capture_time,
}
# Add extra information to capture
capture_md.update(extra_entries)
if extra_entries: capture_md.update(extra_entries)
jhazentia marked this conversation as resolved.
Show resolved Hide resolved

self.sigmf_md.add_capture(sample_start, metadata=capture_md)

Expand Down