diff --git a/README.md b/README.md index 9b81888..52bc349 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ doing inference of this value. The approach this project takes is to use pytorch to capture the relationships in the [Globe At Night dataset](https://globeatnight.org/maps-data/) and use that to predict sky brightness for H3 -cells at a configured H3 resoultion (default `0`). +cells at a configured [H3 resoultion](https://h3geo.org/docs/core-library/restable/) (default `0`). ## running with docker @@ -77,9 +77,8 @@ stars visible) ## changing the resolution -By default, the producer runs over [resolution 0 cells](https://h3geo.org/docs/core-library/restable/), -but this can be adjusted by setting the environment of the `producer` container in -`docker-compose.yaml`: +By default, the producer runs over all resolution 0 cells, but this can be adjusted +by setting the environment of the `producer` container in `docker-compose.yaml`: ```yaml producer: diff --git a/api/README.md b/api/README.md index 04d9322..fc28052 100644 --- a/api/README.md +++ b/api/README.md @@ -27,14 +27,3 @@ with grpc.insecure_channel(f"{host}:{port}") as channel: print(response) ``` - -## model - -### building and training - -The api depends on a model being trained from csv data. - -The following commands will generate a new `model.pth` (i.e. the learned parameters): - -- `python -m api.model.build` to write the csv that the model trains on -- `python -m api.model.train` to train on the data in the csv diff --git a/api/api/config.py b/api/api/config.py index bb60134..66d973c 100644 --- a/api/api/config.py +++ b/api/api/config.py @@ -1,4 +1,3 @@ import os -log_level = int(os.getenv("LOG_LEVEL", 20)) service_port = int(os.getenv("SERVICE_PORT", 50051)) diff --git a/api/api/main.py b/api/api/main.py index ea9e530..2f2d87b 100644 --- a/api/api/main.py +++ b/api/api/main.py @@ -3,17 +3,18 @@ import grpc +from .config import service_port from .stubs import brightness_service_pb2_grpc from .service.brightness_servicer import BrightnessServicer -from .config import log_level, service_port log_format = "%(asctime)s [%(levelname)s] %(message)s" -logging.basicConfig(level=log_level, format=log_format) +logging.basicConfig(level=logging.INFO, format=log_format) log = logging.getLogger(__name__) def serve(): + log.info(f"starting up gRPC server on port {service_port}") server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) brightness_service_pb2_grpc.add_BrightnessServiceServicer_to_server(BrightnessServicer(), server) server.add_insecure_port(f"[::]:{service_port}") @@ -22,5 +23,4 @@ def serve(): if __name__ == "__main__": - log.info(f"starting up gRPC server on port {service_port}") serve() diff --git a/api/model.md b/api/model.md new file mode 100644 index 0000000..ebb9c82 --- /dev/null +++ b/api/model.md @@ -0,0 +1,8 @@ +# model + +## building and training + +The api depends on a model being trained from csv data. + +1. use `python -m api.model.build` to write the csv that the model trains on +2. use `python -m api.model.train` to generate a new `model.pth` (i.e. to learn new parameters) diff --git a/docker-compose.yml b/docker-compose.yml index ec2f3be..5cc99ad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,9 +36,6 @@ services: build: ./api ports: - "50051:50051" - environment: - API_VERSION: "v1" - LOG_LEVEL: 30 restart: on-failure depends_on: openmeteo: