Skip to content

Commit

Permalink
Merge branch 'master' into nasctn-sea
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanielloNTIA committed Jan 19, 2023
2 parents 2aa2169 + c890b3a commit 8cfeca4
Show file tree
Hide file tree
Showing 17 changed files with 109 additions and 94 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ env
venv/
ENV/
scos_sensor_venv/
.venv/

# Spyder project settings
.spyderproject
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@ docker-compose logs --follow api # reattach terminal
When running in a production environment or on a remote system, various settings will
need to be configured.

## docker-compose.yml

- shm_size: This setting is overriding the default setting of 64 mb. If using
scos-sensor on a computer with lower memory, this may need to be decreased. This is
currently only used by the [NasctnSeaDataProduct action](
https://github.com/NTIA/scos-actions/blob/master/scos_actions/actions/acquire_sea_data_product.py
).

### Environment File

As explained in the [Quickstart](#quickstart) section, before running scos-sensor, an
Expand Down
10 changes: 8 additions & 2 deletions configs/sensor_definition.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "seadog03",
"id": "seadog",
"sensor_spec": {
"id": "seadog03",
"id": "seadog",
"model": "seadog"
},
"antenna": {
Expand All @@ -10,6 +10,12 @@
"model": "None"
}
},
"preselector" : {
"preselector_spec" : {
"supplemental_information" : "Oldest rev preselector with no enclosure"
},
"cal_sources" : [ { "enr": 14.53 } ]
},
"signal_analyzer": {
"sigan_spec": {
"id": "",
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
api:
healthcheck:
test: test ! -e /sdr_unhealthy && test ! -e /scheduler_dead
interval: 10s
interval: 6s
timeout: 3s
retries: 1
shm_size: '16gb'
Expand Down
3 changes: 0 additions & 3 deletions docker/Dockerfile-api
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ RUN apt-get update -q && \
swig gcc python3.8-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*


ENV PYTHONUNBUFFERED 1
RUN mkdir -p /src
WORKDIR /src
Expand All @@ -18,12 +17,10 @@ COPY ./src/requirements-dev.txt /src

ARG DOCKER_GIT_CREDENTIALS
RUN git config --global credential.helper store && echo "${DOCKER_GIT_CREDENTIALS}" > ~/.git-credentials

RUN python3.8 -m pip install --upgrade pip
ARG DEBUG
RUN if [ "$DEBUG" = true ]; then python3.8 -m pip install --no-cache-dir -r requirements-dev.txt ; else python3.8 -m pip install --no-cache-dir -r requirements.txt ; fi


COPY ./src /src
COPY ./gunicorn /gunicorn

Expand Down
6 changes: 4 additions & 2 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1640,8 +1640,10 @@
"logger",
"test_monitor_sigan",
"test_multi_frequency_iq_action",
"test_nasctn_sea_data_product",
"test_single_frequency_iq_action",
"test_single_frequency_m4s_action",
"test_survey_iq_action",
"test_sync_gps"
]
},
Expand Down Expand Up @@ -1859,8 +1861,8 @@
},
"duration": {
"title": "Duration",
"description": "Task duration in seconds",
"type": "number"
"description": "Task duration, in %H:%M:%S.%f format",
"type": "string"
},
"data": {
"type": "array",
Expand Down
2 changes: 1 addition & 1 deletion src/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import logging
import pkgutil

from scos_actions.signals import register_action
from scos_actions.discover import test_actions
from scos_actions.signals import register_action

from sensor import settings
from sensor.utils import copy_driver_files
Expand Down
10 changes: 4 additions & 6 deletions src/handlers/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from scos_actions.signals import (
location_action_completed,
measurement_action_completed,
monitor_action_completed,
trigger_api_restart,
)

logger = logging.getLogger(__name__)
Expand All @@ -15,13 +15,13 @@ class HandlersConfig(AppConfig):
name = "handlers"

def ready(self):
from handlers.health_check_handler import trigger_api_restart_callback
from handlers.location_handler import (
db_location_deleted,
db_location_updated,
location_action_completed_callback,
)
from handlers.measurement_handler import measurement_action_completed_callback
from handlers.monitor_handler import monitor_action_completed_callback

measurement_action_completed.connect(measurement_action_completed_callback)
logger.debug(
Expand All @@ -37,7 +37,5 @@ def ready(self):
post_delete.connect(db_location_deleted)
logger.debug("db_location_deleted registered to post_delete")

monitor_action_completed.connect(monitor_action_completed_callback)
logger.debug(
"monitor_action_completed_callback registered to monitor_action_completed"
)
trigger_api_restart.connect(trigger_api_restart_callback)
logger.debug("trigger_api_restart_callback registered to trigger_api_restart")
12 changes: 12 additions & 0 deletions src/handlers/health_check_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import logging
from pathlib import Path

from sensor import settings

logger = logging.getLogger(__name__)


def trigger_api_restart_callback(sender, **kwargs):
logger.warning("triggering API container restart")
if settings.IN_DOCKER:
Path(settings.SDR_HEALTHCHECK_FILE).touch()
19 changes: 0 additions & 19 deletions src/handlers/monitor_handler.py

This file was deleted.

Loading

0 comments on commit 8cfeca4

Please sign in to comment.