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

Support multiple nodes #69

Merged
merged 189 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
189 commits
Select commit Hold shift + click to select a range
934d9a7
DEP: Make h5py a dev dependency
cortadocodes Jun 8, 2022
1198881
DEP: Remove pandas dev dependency
cortadocodes Jun 8, 2022
764a0cc
OPS: Increase patch version number
cortadocodes Jun 8, 2022
c536aed
DEP: Update python compatibility to >=3.7.1, <3.10
cortadocodes Jun 8, 2022
85fc571
DEP: Use correct version of octue in cloud functions
cortadocodes Jun 8, 2022
6f19af9
FIX: Ensure metadata is saved on microphone datafile
cortadocodes Jun 8, 2022
a50acf0
DEP: Use latest octue version to avoid white logs on light terminal
cortadocodes Jun 8, 2022
456a1b9
OPS: Add compute provider envvar to Cloud Function deployments
cortadocodes Jun 8, 2022
0097d39
OPS: Make cloud function builds concurrent in cloudbuild.yaml
cortadocodes Jun 8, 2022
3a64de4
DOC: Add note about inaccurate test coverage figure
cortadocodes Jun 8, 2022
fefb9ef
DEP: Update to octue==0.27.1
cortadocodes Jun 8, 2022
61d6f4a
DEP: Remove scipy from requirements
cortadocodes Jun 8, 2022
6cb7ae2
DEP: Use octue==0.27.2
cortadocodes Jun 8, 2022
4722a1f
FIX: Remove duplicate log message
cortadocodes Jun 8, 2022
fd8b3a2
FIX: Instantiate serial.Serial inside processes instead of sharing
cortadocodes Jun 8, 2022
b5291e1
DEP: Update lock file
cortadocodes Jun 8, 2022
e713b93
TST: Only use fork multiprocessing start method on non-Windows OS
cortadocodes Jun 8, 2022
888ff1c
TST: Skip "test_save_locally" test on Windows
cortadocodes Jun 8, 2022
a0ab77f
DEP: Pin to grpcio==1.45.0 for Raspberry Pi compatibility
time-trader Jun 9, 2022
7ac4467
DEP: Resolve grpcio from piwheels
time-trader Jun 9, 2022
d139979
DEP: Resolve repository ambiguity
time-trader Jun 9, 2022
4ee1e0a
DEP: Update octue sdk version
time-trader Jun 9, 2022
7cfe539
OPS: Update black to remove click conflict
thclark Jun 9, 2022
f4ff01b
ENH: add port poller to tell the port address of the receiver on an rPi
thclark Jun 9, 2022
7b4f2c0
DEP: Lock dependencies per #65 and update devtools to match pre-commit
thclark Jun 10, 2022
4f055ad
OPS: Add devcontainer for vscode users to run out of the box
thclark Jun 10, 2022
a5636f3
DEP: Use octue==0.27.3 in cloud functions
cortadocodes Jun 10, 2022
2a46c55
MRG: Merge branch 'dependencies/remove-unnecessary-dependencies' of g…
cortadocodes Jun 10, 2022
4fcc068
REF: Refactor poll.py
cortadocodes Jun 10, 2022
88143f7
DOC: Update README installation instructions
cortadocodes Jun 10, 2022
d30dae6
MRG: Merge pull request #60 from aerosense-ai/dependencies/remove-unn…
cortadocodes Jun 10, 2022
3dc9da8
REF: Remove incorrectly parameterised default sensor name
thclark Jun 10, 2022
9942ddf
OPS: Update pre-commit to use breaking change features
thclark Jun 10, 2022
bb41551
FEA: Update configuration for multiple nodes per #64
thclark Jun 10, 2022
a7183d2
TST: Make tests use new packet key functionality
thclark Jun 10, 2022
f9731ff
ENH: Add a packet key map property to the configuration
thclark Jun 13, 2022
6ee1b67
ENH: Cache the packet key map to allow quick usage in the reader
thclark Jun 13, 2022
0df081c
WIP: Update data gateway to use new config
thclark Jun 13, 2022
b4bbb0b
OPS: Update tests to python 3.9
thclark Jun 13, 2022
7946e38
CHO: Make minor changes for PR review
thclark Jun 13, 2022
fd07741
OPS: Increase minor version number
cortadocodes Jun 14, 2022
db8cf7f
FIX: Use renamed session data and fix getting default mic sensor name
cortadocodes Jun 14, 2022
00c6db6
FIX: Get baudrate from correct part of config
cortadocodes Jun 14, 2022
e417b2b
Merge pull request #70 from aerosense-ai/feature/multi-node-configura…
thclark Jun 15, 2022
da33201
Merge branch 'feature/multiple-node-support' into feature/multi-node-…
thclark Jun 15, 2022
24f5c55
DEP: Remove blake3 as a development dependency
cortadocodes Jun 16, 2022
be058c3
DEP: Add requirements file for Raspberry Pi
cortadocodes Jun 17, 2022
7120443
DEP: Add gateway package to requirements-pi.txt file
cortadocodes Jun 17, 2022
2e0c748
DEP: Use fixed version of octue
cortadocodes Jun 17, 2022
9669f19
MRG: Merge branch 'feature/multiple-node-support' into fix/make-insta…
cortadocodes Jun 17, 2022
d26b914
DOC: Update Raspberry Pi installation instructions
cortadocodes Jun 17, 2022
f6da059
MRG: Merge remote-tracking branch 'origin/feature/multiple-node-suppo…
cortadocodes Jun 17, 2022
2f22aa2
ENH: Improve warning about blake3 being missing
cortadocodes Jun 21, 2022
94ddb4b
DOC: Update Pi and Linux installation instructions
cortadocodes Jun 21, 2022
4033dd0
DOC: Improve Windows installation instructions
cortadocodes Jun 21, 2022
b8325bc
DOC: Improve blake3 missing warning
cortadocodes Jun 21, 2022
93ea69d
DEP: Rename requirements-pi.txt file
cortadocodes Jun 21, 2022
42a2c82
DEP: Add production version of pi requirements file
cortadocodes Jun 21, 2022
c93036e
DOC: Update Raspberry Pi production installation instructions
cortadocodes Jun 21, 2022
1a6100e
DEP: Use octue==0.29.2
cortadocodes Jun 21, 2022
1e0195b
OPS: Restore version number
cortadocodes Jun 21, 2022
3784173
MRG: Merge pull request #72 from aerosense-ai/fix/make-installation-o…
cortadocodes Jun 21, 2022
b13aad6
MRG: Merge remote-tracking branch 'origin/feature/multiple-node-suppo…
cortadocodes Jun 27, 2022
e0a6b51
TST: Restore testing environment to python3.8
cortadocodes Jun 27, 2022
0f70f58
REF: Remove duplicated import
cortadocodes Jun 27, 2022
b02db68
FIX: Fix configuration conversions to/from dictionaries
cortadocodes Jun 27, 2022
eb2e9f0
FIX: Include sensor periods in node configuration serialisation
cortadocodes Jun 27, 2022
eb85a4c
TST: Update configuration usage in test
cortadocodes Jun 27, 2022
418abf1
FIX: Get serial port buffer size correctly
cortadocodes Jun 27, 2022
562a1bd
FIX: Update non-persistence usages of configuration in PacketReader
cortadocodes Jun 27, 2022
a6c5212
ENH: Update batchers for multiple nodes
cortadocodes Jun 27, 2022
db380c5
ENH: Remove sensor timestamp offset calculation and persistence
cortadocodes Jun 27, 2022
3562ba8
ENH: Use node ID when persisting data in PacketReader
cortadocodes Jun 27, 2022
55a1db1
FIX: Fix list of default sensor names
cortadocodes Jun 27, 2022
9b3466b
TST: Add node ID to queue in tests
cortadocodes Jun 27, 2022
ba4cf73
FIX: Ensure node IDs are always strings
cortadocodes Jun 27, 2022
8852bce
FIX: Get the node ID from the serial port properly
cortadocodes Jun 27, 2022
668ad31
FIX: Add missing "node_id" subscriptions in PacketReader
cortadocodes Jun 27, 2022
249ed3c
FIX: Update to new way of accessing samples per packet for sensors
cortadocodes Jun 27, 2022
0e67457
TST: Update data gateway tests to use node IDs
cortadocodes Jun 27, 2022
4e25866
TST: Rename test constant
cortadocodes Jun 27, 2022
86a1b28
TST: Update CLI test
cortadocodes Jun 27, 2022
3d67940
ENH: Remove timestamp conversion from cloud function
cortadocodes Jun 27, 2022
a0e9c25
FIX: Update configuration keys used in cloud function
cortadocodes Jun 27, 2022
ffb8a38
TST: Update DatasetMixin.random_window to multi-node format
cortadocodes Jun 27, 2022
ddfd056
FIX: Ensure dictionary combination works on python3.8
cortadocodes Jun 27, 2022
6a1911a
TST: Fix upload test
cortadocodes Jun 27, 2022
6e8014b
OPS: Ignore wireguard creds in root dir
thclark Jun 28, 2022
34ec453
ENH: Update cloud function to store data for multiple nodes
cortadocodes Jun 28, 2022
e4aa73c
MRG: Merge branch 'feature/multi-node-gateway-updates' of github.com:…
cortadocodes Jun 28, 2022
de07a9d
DEP: Remove cached property to allow use on python 3.7
time-trader Jun 28, 2022
bb2cbbd
Merge branch 'feature/multi-node-gateway-updates' of github.com:aeros…
time-trader Jun 28, 2022
46e1d26
DOC: Start developing examples set for configurations and routines
thclark Jun 28, 2022
f227738
MRG: Merge branch 'feature/multi-node-gateway-updates' of github.com:…
thclark Jun 28, 2022
ebc06eb
REF: Simplify dictcomps
cortadocodes Jun 28, 2022
1b253a2
REF: Improve readability in PacketReader
cortadocodes Jun 28, 2022
d2ccce9
REF: Factor out node config in PacketReader
cortadocodes Jun 28, 2022
74117bf
DOC: Update configuration docstrings
cortadocodes Jun 28, 2022
9754f1a
DOC: Update persistence docstrings
cortadocodes Jun 28, 2022
66a45ab
TST: Simplify test method
cortadocodes Jun 28, 2022
4449326
MRG: Merge branch 'feature/multi-node-gateway-updates' of
cortadocodes Jun 28, 2022
ff8d1f7
DOC: Add extra examples
thclark Jun 28, 2022
a326005
MRG: Merge branch 'feature/multi-node-gateway-updates' of github.com:…
thclark Jun 28, 2022
388b262
ENH: Remove sensor coordinates from installation data
cortadocodes Jun 28, 2022
56c26bc
ENH: Move sensor coordinates validation into NodeConfiguration
cortadocodes Jun 28, 2022
e516170
TST: Update CreateInstallation tests
cortadocodes Jun 28, 2022
76634b3
ENH: Update installation data references and field names
cortadocodes Jun 28, 2022
fcf29e0
ENH: Remove blade ID from installation table
cortadocodes Jun 28, 2022
a6f371b
WIP: Adding new capability to parser
thclark Jun 29, 2022
abaa722
WIP: Warn on missing packet key
thclark Jun 29, 2022
ad43a61
FIX: Add bye endian to decode
thclark Jun 29, 2022
8416310
FIX: Make available packet keys a list of ints
thclark Jun 29, 2022
e2dff2d
FIX: Make available packet keys a list of ints
thclark Jun 29, 2022
28b2a2d
WIP: Debugging lost packet type on multi node configuration
thclark Jun 29, 2022
d640dbe
WIP: Remove temporarily the sensor stops on clearup
thclark Jun 29, 2022
a2fadac
WIP: Additional debug logging of packet types
thclark Jun 29, 2022
6b5099b
WIP: Additional debug logging of packet types
thclark Jun 29, 2022
ad72205
ENH: Remove redundant project name field from microphone data table
cortadocodes Jun 29, 2022
a755a29
WIP: Handle base station as node_id=0
thclark Jun 29, 2022
944fe4a
MRG: Merge branch 'feature/multi-node-gateway-updates' of github.com:…
thclark Jun 29, 2022
b0d425a
WIP: Fix packet key offset
thclark Jun 29, 2022
05688c9
WIP: Work around packets from base station
thclark Jun 29, 2022
1fce660
WIP: Work around packets from base station
thclark Jun 29, 2022
db0bea0
REF: Change packet_key things to leading bytes
thclark Jun 29, 2022
0d5a31c
WIP: Fix up example
thclark Jun 29, 2022
b0ad89a
WIP: Update node id
thclark Jun 29, 2022
7c3e75d
WIP: Update node id
thclark Jun 29, 2022
2e49447
WIP: Set id to 2
thclark Jun 29, 2022
84964c8
DOC: Update developer installation instructions
cortadocodes Jun 29, 2022
fbb8363
OPS: Enable use of balena
thclark Jun 29, 2022
9a4dba4
OPS: Tweaks to dockerfile
thclark Jun 29, 2022
113fe75
OPS: Enable device variables to override paths for quicker cli use
thclark Jun 29, 2022
24f1da8
WIP: Tweak the configuration for node 4
thclark Jun 29, 2022
d506fed
FIX: Ensure exceptions are not removed by the finally clause
thclark Jun 30, 2022
5730c79
CHO: Typo
thclark Jun 30, 2022
c6d4489
CHO: Remove print statement form debugging
thclark Jun 30, 2022
ea8d604
OPS: Add docker-compose file to get named volume in balena
thclark Jun 30, 2022
00249b3
FIX: Specify local build in docker-compose
thclark Jun 30, 2022
84d65b4
OPS: Add privilege to the main container to access hardware
thclark Jun 30, 2022
0d925da
REF: Refactor Configuration slightly
cortadocodes Jun 30, 2022
d7a345f
TST: Use updated Configuration method name
cortadocodes Jun 30, 2022
a472187
REV: Re-allow nodes with "0" as their ID
cortadocodes Jun 30, 2022
108a5d4
TST: Update error message test
cortadocodes Jun 30, 2022
b10a130
OPS: Remove unused data dir from dockerfile
thclark Jun 30, 2022
b7dabd0
TST: Update valid_configuration.json test fixture
cortadocodes Jun 30, 2022
5d357f5
TST: Update info packets test
cortadocodes Jun 30, 2022
58ecafd
OPS: Remove config file from supervisord generation
thclark Jun 30, 2022
31ab9e2
ENH: Add stop rutine ability
thclark Jun 30, 2022
85c661c
ENH: Add example configs for aventa tests
thclark Jun 30, 2022
e33fee5
FIX: Make default path on stop_routine work
thclark Jun 30, 2022
9b14cf4
FIX: Not strictly ascending example routine
thclark Jun 30, 2022
5d9947f
OPS: Add debug logger for rerceived packet types
thclark Jun 30, 2022
4d699d6
Merge pull request #81 from aerosense-ai/feature/balena-deploy
thclark Jul 1, 2022
9e7d9e6
WIP: Remove too-verbose logging on packet reciept
thclark Jul 1, 2022
61e5718
OPS: Add a balena deploy workflow for pushes to main
thclark Jul 1, 2022
50dc38a
Merge pull request #82 from aerosense-ai/feature/balena-deploy
thclark Jul 1, 2022
b2aac94
OPS: Ignore vscode local settings
thclark Jul 1, 2022
6a5af4b
MRG: Merge branch 'feature/multi-node-gateway-updates' of github.com:…
thclark Jul 1, 2022
f5a4d84
TST: Update info packet test
cortadocodes Jul 4, 2022
7382d85
TST: Remove directory made by test when finished
cortadocodes Jul 4, 2022
978a6cc
TST: Test DataGateway with two nodes
cortadocodes Jul 4, 2022
f06caf1
TST: Rename test constant
cortadocodes Jul 4, 2022
bf4feea
OPS: Add installation reference to example configs
thclark Jul 6, 2022
bdcd1af
OPS: Prevent logger from flooding outputs in packet reader
thclark Jul 6, 2022
a6da880
OPS: Add diagnostic to persistence
thclark Jul 6, 2022
bf125f9
OPS: Add diagnostic to persistence
thclark Jul 6, 2022
d4fdcf8
ENH: Add bucket name as environment variable
thclark Jul 6, 2022
e07dd05
OPS: temporary add of old testing script
thclark Jul 6, 2022
9b56872
CHO: Latest packet reader changes
thclark Jul 6, 2022
123f2da
FIX: Remove dead getBattery command
thclark Jul 6, 2022
dd14ef6
OPS: Log upload destination prior to attempt
thclark Jul 7, 2022
f9b4743
OPS: Add debugging display for use in interactive mode
thclark Jul 7, 2022
6576830
ENH: Add quick routine for debugging
thclark Jul 7, 2022
686fdf0
FIX: Give a default bucket name and make override work
thclark Jul 7, 2022
c3a220c
OPS: Make message more informative
thclark Jul 7, 2022
33c472a
ENH: Make cloud functions robust against empty data
thclark Jul 7, 2022
fe6c480
OPS: Add debug statement to window handler
thclark Jul 7, 2022
9e01d06
OPS: Allow deployment of gcloud test functions
thclark Jul 7, 2022
d2501a1
OPS: Change to Workload Identity Federation
thclark Jul 7, 2022
c3a41e5
OPS: Give permission for workload identity federation use
thclark Jul 7, 2022
eebf9ef
OPS: Wire up correct entry points
thclark Jul 7, 2022
f8b02b4
OPS: Make ingress trigger on file uploads
thclark Jul 7, 2022
751e1f9
OPS: Remove incompatible trigger type specificaiton
thclark Jul 7, 2022
3b4ed9f
Merge pull request #71 from aerosense-ai/feature/multi-node-gateway-u…
thclark Jul 7, 2022
b49fab5
OPS: Prevent serialisation erorr in window handler debugging statement
thclark Jul 7, 2022
8c51f08
TST: Update test to work with new print outputs
thclark Jul 7, 2022
47775ec
OPS: Make workflows apply correct memory
thclark Jul 7, 2022
f8bad20
OPS: Remove old cloudbuild
thclark Jul 7, 2022
a1783e7
CHO: Update pull request template heading size
cortadocodes Jul 7, 2022
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
1 change: 1 addition & 0 deletions .devcontainer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.zsh_history
40 changes: 40 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# A useful base repository based on ms devcontainer but with a bunch of fixes
# and useful installs (geo tools are unnecessary for this project, but all the other tweaks are helpful)
FROM windpioneers/gdal-python:familiar-catshark-gdal-2.4.1-python-3.9-dev

# Tell zsh where you want to store history
# We leave you to decide, but if you put this into a folder that's been mapped
# into the container, then history will persist over container rebuilds :)
#
# !!!IMPORTANT!!!
# Make sure your .zsh_history file is NOT committed into your repository, as it can contain
# sensitive information. So in this case, you should add
# .devcontainer/.zsh_history
# to your .gitignore file.
#
ENV HISTFILE="/workspaces/data-gateway/.devcontainer/.zsh_history"

# Switch to vscode user
USER vscode
WORKDIR /workspaces/data-gateway

# Install the rust toolchain and give permission for all users to use it
ENV RUST_INSTALL_DIR=/home/vscode/.rust
ENV RUSTUP_HOME="${RUST_INSTALL_DIR}/rustup"
ENV CARGO_HOME="${RUST_INSTALL_DIR}/cargo"
RUN mkdir -p ${RUSTUP_HOME} && \
mkdir -p ${CARGO_HOME}
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="${CARGO_HOME}/bin:${PATH}"
RUN chmod -R ugo+rwx ${RUST_INSTALL_DIR}

# Install poetry
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
ENV PATH "/home/vscode/.poetry/bin:$PATH"
RUN poetry config virtualenvs.create false

# Install python dependencies. Note that poetry installs any root packages by default,
# But this is not available at this stage of caching dependencies. So we do a dependency-only install here
# to cache the dependencies, then a full poetry install post-create to install any root packages.
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-ansi --no-interaction --no-root
84 changes: 84 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/python-3
{
"name": "Data-Gateway Devcontainer",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
// Set *default* container specific settings.json values on container create.
"settings": {
"austin.mode": "Wall time",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"esbonio.server.enabled": true,
"esbonio.sphinx.confDir": "${workspaceFolder}/docs/source",
"jupyter.widgetScriptSources": ["jsdelivr.com", "unpkg.com"],
"prettier.prettierPath": "/usr/local/prettier",
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.provider": "black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.languageServer": "Pylance",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.enabled": true,
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
// Line length to match black settings
// Disabling specific messages:
// - To find the details do: /usr/local/py-utils/bin/pylint --list-msgs
// - Disable missing-module-docstring (C0114) because we don't document modules routinely, just their members
// - Disable invalid-name (C0103) because pylint thinks that eg 'x', 'df', 'np' are invalid due to their lengths
"python.linting.pylintArgs": [
"--max-line-length=120",
"--disable=missing-module-docstring,invalid-name"
],
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.pythonPath": "/usr/local/bin/python",
// Scrolling the editor is a nice idea but it doesn't work: always out of sync and impossible to manage
"restructuredtext.preview.scrollEditorWithPreview": false,
"restructuredtext.preview.scrollPreviewWithEditor": false,
"restructuredtext.linter.doc8.extraArgs": ["--max-line-length 180"],
"terminal.integrated.defaultProfile.linux": "zsh"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"bungcip.better-toml",
"[email protected]",
"irongeek.vscode-env",
"lextudio.restructuredtext",
"me-dutour-mathieu.vscode-github-actions",
"mikestead.dotenv",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter",
"ms-toolsai.jupyter-renderers",
"ms-toolsai.jupyter-keymap",
"ms-vsliveshare.vsliveshare",
"p403n1x87.austin-vscode",
"ritwickdey.liveserver",
"trond-snekvik.simple-rst"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [80, 443, 5000, 7045, 7046, 7047, 7048, 7049, 8000, 8080],

// Poetry install *with* the root, which can't be cached in the docker layers (see dockerfile)
"postCreateCommand": "poetry install && pre-commit install && pre-commit install -t commit-msg",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",

// Allow ptrace based debuggers (like austin) to work in the container
"runArgs": [
"--env-file",
"${localWorkspaceFolder}/.env",
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
]
}
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**/.DS_Store
.coverage
.devcontainer/
.env
.pytest_cache/
.tox/
.venv/
.vscode/
*.wg.conf
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<!-- However, any part of the final PR description (i.e. the description at the point of the final commit to the PR) can be changed and will be retained when producing the release notes -->
<!-- Please don't add features not discussed in an issue first -->

## Summary
# Summary

<!--- START AUTOGENERATED NOTES --->
<!--- END AUTOGENERATED NOTES --->

## Quality Checklist
# Quality Checklist

- [ ] New features are fully tested (No matter how much Coverage Karma you have)
- [ ] **[v0.2 onward]** New features are included in the documentation
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/balena.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: balena

on:
push:
branches:
- main

jobs:
balena-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/[email protected]
- uses: theaccordance/[email protected]
with:
api-token: ${{secrets.BALENA_API_TOKEN}}
application-name: ${{secrets.BALENA_APPLICATION_NAME}}
68 changes: 68 additions & 0 deletions .github/workflows/gcloud-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: gcloud-deploy

on:
push:
branches:
- main
- test

jobs:
deploy:
permissions:
contents: "read"
id-token: "write"
runs-on: ubuntu-latest
steps:
- id: checkout
uses: actions/checkout@v2

- name: Get prefix (test- or nothing for production)
id: prefix
run: |
if [ "${{ github.ref }}" = "main" ]; then
echo "::set-output name=name_prefix::"
else
echo "::set-output name=name_prefix::test-"
fi

- id: auth
uses: google-github-actions/auth@v0
with:
workload_identity_provider: "projects/885434704038/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider"
service_account: "[email protected]"

- id: deploy-add-sensor-type
uses: google-github-actions/deploy-cloud-functions@v0
with:
name: ${{ steps.prefix.outputs.name_prefix }}add-sensor-type
description: Allows addition of a new sensor type whose values will be accepted into the database
entry_point: add_sensor_type
runtime: python39
region: europe-west6
env_vars: BIG_QUERY_DATASET_NAME=${{ steps.prefix.outputs.name_prefix }}greta,COMPUTE_PROVIDER=GOOGLE_CLOUD_FUNCTION,DESTINATION_PROJECT_NAME=aerosense-twined
source_dir: cloud_functions

- id: deploy-create-installation
uses: google-github-actions/deploy-cloud-functions@v0
with:
name: ${{ steps.prefix.outputs.name_prefix }}create-installation
description: Allows creation of a new installation
entry_point: create_installation
runtime: python39
region: europe-west6
env_vars: BIG_QUERY_DATASET_NAME=${{ steps.prefix.outputs.name_prefix }}greta,COMPUTE_PROVIDER=GOOGLE_CLOUD_FUNCTION,DESTINATION_PROJECT_NAME=aerosense-twined
source_dir: cloud_functions

- id: deploy-ingress-eu
uses: google-github-actions/deploy-cloud-functions@v0
with:
name: ${{ steps.prefix.outputs.name_prefix }}ingress-eu
entry_point: upload_window
runtime: python39
region: europe-west6
memory: 1GB
env_vars: BIG_QUERY_DATASET_NAME=${{ steps.prefix.outputs.name_prefix }}greta,COMPUTE_PROVIDER=GOOGLE_CLOUD_FUNCTION,DESTINATION_PROJECT_NAME=aerosense-twined,DESTINATION_BUCKET_NAME=data-gateway-processed-data,SOURCE_PROJECT_NAME=aerosense-twined
source_dir: cloud_functions
event_trigger_type: google.storage.object.finalize
event_trigger_resource: projects/_/buckets/${{ steps.prefix.outputs.name_prefix }}aerosense-ingress-eu
event_trigger_service: storage.googleapis.com
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,9 @@ ENV/

.DS_store
.pytest_cache

# Wireguard credentials
*.wg.conf

# VSCode local settings
.vscode
50 changes: 26 additions & 24 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
exclude: 'build|docs|node_modules|.git|.tox|dist|docs|data_gateway.egg-info'
exclude: "build|docs|node_modules|.git|.tox|dist|docs|data_gateway.egg-info"
default_stages: [commit]
fail_fast: true
default_language_version:
python: python3 # force all unspecified python hooks to run python3
python: python3 # force all unspecified python hooks to run python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
Expand All @@ -18,58 +18,60 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 21.6b0
rev: 22.3.0
hooks:
- id: black
args: ['--line-length', '120']
args: ["--line-length", "120"]

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
language_version: python3
additional_dependencies:
- 'pep8-naming'
- "pep8-naming"
args:
- --ignore-names=setUp,tearDown,setUpClass,tearDownClass,asyncSetUp,asyncTearDown,setUpTestData,failureException,longMessage,maxDiff,startTestRun,stopTestRun

- repo: https://github.com/pycqa/pydocstyle
rev: 6.1.1
hooks:
- id: pydocstyle
- id: pydocstyle

- repo: https://github.com/thclark/pre-commit-sphinx
rev: 0.0.3
hooks:
- id: build-docs
language_version: python3
additional_dependencies:
- 'poetry>=1,<2'
- 'Sphinx>=4,<5'
- 'sphinx-rtd-theme>=1,<2'
- 'sphinx-tabs>=3,<4'
- 'sphinx-autoapi==1.8.4'
- "poetry>=1,<2"
- "Sphinx>=4,<5"
- "sphinx-rtd-theme>=1,<2"
- "sphinx-tabs>=3,<4"
- "sphinx-autoapi==1.8.4"

- repo: https://github.com/windpioneers/pre-commit-hooks
rev: 0.0.5
hooks:
- id: check-branch-name
language_version: python3
args:
- '^main$'
- '^development$'
- '^devops/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^doc/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^feature/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^fix/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^hotfix/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^review/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^refactor/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^enhancement/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^test/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- "^main$"
- "^test$"
- "^devops/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^doc/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^feature/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^fix/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^hotfix/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^review/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^refactor/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^enhancement/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^dependencies/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"

- repo: https://github.com/octue/conventional-commits
rev: 0.3.1
- repo: https://github.com/octue/pre-commit-hooks
rev: 0.6.0
hooks:
- id: check-commit-message-is-conventional
stages: [commit-msg]
args:
- --maximum-body-line-length=2000
26 changes: 26 additions & 0 deletions Dockerfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# base-image for python on any machine using a template variable,
# see more about dockerfile templates here: https://www.balena.io/docs/learn/develop/dockerfile/
FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-python:3.8-bullseye-run

# Install git for development purposes
RUN install_packages git

# Set our working directory
RUN mkdir -p /usr/aerosense/data-gateway
WORKDIR /usr/aerosense/data-gateway

# Copy requirements.txt first for better cache on later pushes
COPY requirements-pi.txt requirements-pi.txt

# Install python deps on the resin.io build server
RUN pip install -r requirements-pi.txt

# Copy and install the project, to source the gateway CLI
COPY . ./
RUN pip install .

# Enable udevd so that plugged dynamic hardware devices show up in our container.
ENV UDEV=1

# Keep the container alive after start, so we can ssh in and use the gateway
CMD ["sleep", "infinity"]
Loading