From 713c54d7a4896021996b47d4396c4a5fc8f6e6ff Mon Sep 17 00:00:00 2001 From: salsal97 Date: Thu, 14 Sep 2023 00:19:08 +0000 Subject: [PATCH] add and activate point robinson hydrophone --- InferenceSystem/README.md | 16 +++++++- .../FastAI_LiveHLS_PointRobinson.yml | 10 +++++ InferenceSystem/deploy-aci.yaml | 15 ++++++++ InferenceSystem/deploy/point-robinson.yaml | 38 +++++++++++++++++++ .../src/LiveInferenceOrchestrator.py | 3 +- InferenceSystem/src/globals.py | 1 + 6 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 InferenceSystem/config/Production/FastAI_LiveHLS_PointRobinson.yml create mode 100644 InferenceSystem/deploy/point-robinson.yaml diff --git a/InferenceSystem/README.md b/InferenceSystem/README.md index 2d554bdf..f2fb087f 100644 --- a/InferenceSystem/README.md +++ b/InferenceSystem/README.md @@ -152,6 +152,18 @@ This can be completed in two ways. INFERENCESYSTEM_APPINSIGHTS_CONNECTION_STRING= ``` +## Adding a new hydrophone + +1. Create a new config file under the [config](config) folder + +2. Update the last line of the [Dockerfile](Dockerfile) to point to the new config file + +3. Create a new deployment YAML under the [deploy](deploy) folder + +4. Update [src/LiveInferenceOrchestrator.py](src/LiveInferenceOrchestrator.py) and [src/globals.py](src/globals.py) to add variables for the new hydrophone location + +5. Follow all other steps below until you update the kubernetes cluster with the new namespace + ## Building the docker container for production From the `InferenceSystem` directory, run the following command. @@ -164,7 +176,8 @@ docker build . -t live-inference-system -f ./Dockerfile Note: the config used in the Dockerfile is a Production config. -TODO: fix. For now, you will have to manually create 3 different docker containers for the 3 hydrophone locations. Each time you will need to edit the Dockerfile and replace the config for each hydrophone location (OrcasoundLab, BushPoint, PortTownsend). +TODO: fix. For now, you will have to manually create 5 different docker containers for the 5 hydrophone locations. Each time you will need to edit the Dockerfile and replace the config for each hydrophone location (OrcasoundLab, BushPoint, PortTownsend, Sunset Bay and Point Robinson). + ## Running the docker container @@ -300,6 +313,7 @@ kubectl logs -n bush-point inference-system-6d4845c5bc-tfsbw
Deployment to Azure Container Instances (deprecated) # Deploying an updated docker build to Azure Container Instances +# This method has been deprecated ## Prerequisites diff --git a/InferenceSystem/config/Production/FastAI_LiveHLS_PointRobinson.yml b/InferenceSystem/config/Production/FastAI_LiveHLS_PointRobinson.yml new file mode 100644 index 00000000..af23a1ee --- /dev/null +++ b/InferenceSystem/config/Production/FastAI_LiveHLS_PointRobinson.yml @@ -0,0 +1,10 @@ +model_type: "FastAI" +model_local_threshold: 0.5 +model_global_threshold: 3 +model_path: "./model" +model_name: "model.pkl" +hls_stream_type: "LiveHLS" +hls_polling_interval: 60 +hls_hydrophone_id: "rpi_point_robinson" +upload_to_azure: True +delete_local_wavs: True diff --git a/InferenceSystem/deploy-aci.yaml b/InferenceSystem/deploy-aci.yaml index e8cadfd5..d8bee941 100644 --- a/InferenceSystem/deploy-aci.yaml +++ b/InferenceSystem/deploy-aci.yaml @@ -65,6 +65,21 @@ properties: requests: cpu: 1.0 memoryInGB: 3 + - name: point-robinson-live + properties: + environmentVariables: + - name: AZURE_COSMOSDB_PRIMARY_KEY + secureValue: '' + - name: AZURE_STORAGE_CONNECTION_STRING + secureValue: '' + - name: INFERENCESYSTEM_APPINSIGHTS_CONNECTION_STRING + secureValue: '' + image: orcaconservancycr.azurecr.io/live-inference-system:11-15-20.FastAI.R1-12.PointRobinson.v0 + ports: [] + resources: + requests: + cpu: 1.0 + memoryInGB: 3 imageRegistryCredentials: - server: orcaconservancycr.azurecr.io username: orcaconservancycr diff --git a/InferenceSystem/deploy/point-robinson.yaml b/InferenceSystem/deploy/point-robinson.yaml new file mode 100644 index 00000000..89e7c5eb --- /dev/null +++ b/InferenceSystem/deploy/point-robinson.yaml @@ -0,0 +1,38 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: inference-system + namespace: point-robinson +spec: + replicas: 1 + selector: + matchLabels: + app: inference-system + template: + metadata: + labels: + app: inference-system + spec: + containers: + - name: inference-system + image: orcaconservancycr.azurecr.io/live-inference-system:11-15-20.FastAI.R1-12.PointRobinson.v0 + resources: + limits: + cpu: 1 + memory: 3G + env: + - name: AZURE_COSMOSDB_PRIMARY_KEY + valueFrom: + secretKeyRef: + name: inference-system + key: AZURE_COSMOSDB_PRIMARY_KEY + - name: AZURE_STORAGE_CONNECTION_STRING + valueFrom: + secretKeyRef: + name: inference-system + key: AZURE_STORAGE_CONNECTION_STRING + - name: INFERENCESYSTEM_APPINSIGHTS_CONNECTION_STRING + valueFrom: + secretKeyRef: + name: inference-system + key: INFERENCESYSTEM_APPINSIGHTS_CONNECTION_STRING diff --git a/InferenceSystem/src/LiveInferenceOrchestrator.py b/InferenceSystem/src/LiveInferenceOrchestrator.py index f29c3d7a..905700e8 100644 --- a/InferenceSystem/src/LiveInferenceOrchestrator.py +++ b/InferenceSystem/src/LiveInferenceOrchestrator.py @@ -37,8 +37,9 @@ PORT_TOWNSEND_LOCATION = {"id": "rpi_port_townsend", "name": "Port Townsend", "longitude": -122.76045, "latitude": 48.13569} BUSH_POINT_LOCATION = {"id": "rpi_bush_point", "name": "Bush Point", "longitude": -122.6039, "latitude": 48.03371} SUNSET_BAY_LOCATION = {"id": "rpi_sunset_bay", "name": "Sunset Bay", "longitude": -122.3339, "latitude": 47.86497} +POINT_ROBINSON_LOCATION = {"id": "rpi_point_robinson", "name": "Point Robinson", "longitude": -122.37267, "latitude": 47.38838} -source_guid_to_location = {"rpi_orcasound_lab" : ORCASOUND_LAB_LOCATION, "rpi_port_townsend" : PORT_TOWNSEND_LOCATION, "rpi_bush_point": BUSH_POINT_LOCATION, "rpi_sunset_bay": SUNSET_BAY_LOCATION } +source_guid_to_location = {"rpi_orcasound_lab" : ORCASOUND_LAB_LOCATION, "rpi_port_townsend" : PORT_TOWNSEND_LOCATION, "rpi_bush_point": BUSH_POINT_LOCATION, "rpi_sunset_bay": SUNSET_BAY_LOCATION, "rpi_point_robinson": POINT_ROBINSON_LOCATION } def assemble_blob_uri(container_name, item_name): diff --git a/InferenceSystem/src/globals.py b/InferenceSystem/src/globals.py index 3e2abf58..dbd89a2c 100644 --- a/InferenceSystem/src/globals.py +++ b/InferenceSystem/src/globals.py @@ -5,6 +5,7 @@ "port_townsend": "https://s3-us-west-2.amazonaws.com/streaming-orcasound-net/rpi_port_townsend", "bush_point": "https://s3-us-west-2.amazonaws.com/streaming-orcasound-net/rpi_bush_point", "sunset_bay": "https://s3-us-west-2.amazonaws.com/streaming-orcasound-net/rpi_sunset_bay", + "point_robinson": "https://s3-us-west-2.amazonaws.com/streaming-orcasound-net/rpi_point_robinson", } # Limits time window (end - start) of negative samples to be downloaded for retraining