Skip to content

Commit

Permalink
Merge pull request #959 from anarkiwi/rename
Browse files Browse the repository at this point in the history
Rename API container to worker, which is actually what it is.
  • Loading branch information
anarkiwi authored Nov 8, 2023
2 parents f92b8cd + c79842f commit bc022a9
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
docker build -f docker/Dockerfile.torchsig . -t iqtlabs/gamutrf-torchsig:latest
docker run -t iqtlabs/gamutrf:latest gamutrf-scan --help
docker run -t iqtlabs/gamutrf:latest gamutrf-sigfinder --help
docker run -t iqtlabs/gamutrf:latest gamutrf-api --help
docker run -t iqtlabs/gamutrf:latest gamutrf-worker --help
docker run -t iqtlabs/gamutrf:latest gamutrf-samples2raw --help
docker run -t iqtlabs/gamutrf:latest gamutrf-freqxlator --help
docker run -t iqtlabs/gamutrf:latest gamutrf-waterfall --help
Expand Down
4 changes: 2 additions & 2 deletions bin/gamutrf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Options:
-h, help print this help
-i, install install GamutRF repo, optionally supply a version, tag, branch, or tarball
-l, logs tail GamutRF logs
-r, run specify GamutRF tool to run (and any additional args for the tools), options include: 'api', 'freqxlator', 'samples2raw', 'scan', 'sigfinder', 'specgram'
-r, run specify GamutRF tool to run (and any additional args for the tools), options include: 'worker', 'freqxlator', 'samples2raw', 'scan', 'sigfinder', 'specgram'
-R, restart specify 'orchestrator' or 'worker' to restart
-s, start specify 'orchestrator' or 'worker' to start
-S, stop specify 'orchestrator' or 'worker' to stop
Expand Down Expand Up @@ -136,7 +136,7 @@ function check_args()
;;
-r|run)
if [ -z "$2" ]; then
echo "Specify 'api', 'freqxlator', 'samples2raw', 'scan', 'sigfinder', or 'specgram' to run"
echo "Specify 'worker', 'freqxlator', 'samples2raw', 'scan', 'sigfinder', or 'specgram' to run"
exit
fi
docker run -it -v "$VOLUME_DIR":/data iqtlabs/gamutrf:"$VERS" gamutrf-"$2" "${@:3}"
Expand Down
4 changes: 2 additions & 2 deletions docs/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ If run in `recorder` mode (the default) no changes on the worker are needed, but

If run in `RSSI` mode the `worker.yml` file under the gamutrf directory needs to be updated to include the following options:
```
gamutrf-api:
gamutrf-worker:
restart: always
image: iqtlabs/gamutrf:latest
networks:
Expand All @@ -319,7 +319,7 @@ If run in `RSSI` mode the `worker.yml` file under the gamutrf directory needs to
- nice
- '-n'
- '-19'
- gamutrf-api
- gamutrf-worker
- --no-agc
- --rxb=62914560
- '--gain=${GAIN}'
Expand Down
8 changes: 4 additions & 4 deletions gamutrf/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Main entrypoint for GamutRF"""
from gamutrf.api import main as api_main
from gamutrf.worker import main as worker_main
from gamutrf.compress_dirs import main as compress_dirs_main
from gamutrf.freqxlator import main as freqxlator_main
from gamutrf.samples2raw import main as samples2raw_main
Expand All @@ -9,9 +9,9 @@
from gamutrf.waterfall import main as waterfall_main


def api():
"""Entrypoint for API"""
api_main()
def worker():
"""Entrypoint for worker"""
worker_main()


def compress_dirs():
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pytype = "2023.10.31"
pdbpp = "^0.10.3"

[tool.poetry.scripts]
gamutrf-api = 'gamutrf.__main__:api'
gamutrf-worker = 'gamutrf.__main__:worker'
gamutrf-freqxlator = 'gamutrf.__main__:freqxlator'
gamutrf-samples2raw = 'gamutrf.__main__:samples2raw'
gamutrf-scan = 'gamutrf.__main__:scan'
Expand Down
12 changes: 6 additions & 6 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
from falcon import testing

from gamutrf import api
from gamutrf import worker


class FakeArgs:
Expand Down Expand Up @@ -32,7 +32,7 @@ def __init__(self):

@pytest.fixture(scope="module")
def client():
app = api.API(FakeArgs())
app = worker.API(FakeArgs())
return testing.TestClient(app.app)


Expand All @@ -46,21 +46,21 @@ def test_routes(client):


def test_report_rssi():
app = api.API(FakeArgs())
app = worker.API(FakeArgs())
app.report_rssi({"center_freq": 1e6}, -35, time.time())


def test_serve_recording():
app = api.API(FakeArgs())
app = worker.API(FakeArgs())
app.q.put({"center_freq": 1e6, "sample_count": 1e6})
app.serve_recording(app.record)


def test_serve_rssi():
app = api.API(FakeArgs())
app = worker.API(FakeArgs())
app.q.put({"center_freq": 1e6, "sample_count": 1e6, "sample_rate": 1e6})
app.serve_rssi()


def test_argument_parse():
api.argument_parser()
worker.argument_parser()
2 changes: 1 addition & 1 deletion tests/test_birdseye_rssi.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def test_birdseye_endtoend_rssi(self):
command=[
"timeout",
"60s",
"gamutrf-api",
"gamutrf-worker",
"--rssi_threshold=-100",
"--rssi",
f"--sdr=file:{testraw}",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import sys

from gamutrf.__main__ import api
from gamutrf.__main__ import worker
from gamutrf.__main__ import freqxlator
from gamutrf.__main__ import samples2raw
from gamutrf.__main__ import scan
Expand All @@ -12,9 +12,9 @@
sys.argv.append("-h")


def test_main_api():
def test_main_worker():
with pytest.raises(SystemExit) as pytest_wrapped_e:
api()
worker()
assert pytest_wrapped_e.type == SystemExit
assert pytest_wrapped_e.value.code == 0

Expand Down
4 changes: 2 additions & 2 deletions worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: "3.3"
networks:
gamutrf:
services:
api:
worker:
restart: always
image: iqtlabs/gamutrf:latest
networks:
Expand All @@ -29,7 +29,7 @@ services:
- nice
- '-n'
- '-19'
- gamutrf-api
- gamutrf-worker
- --no-agc
- --rxb=62914560
- '--gain=${GAIN}'
Expand Down

0 comments on commit bc022a9

Please sign in to comment.