Skip to content

Commit

Permalink
Merge branch 'issue117-unconfigify'
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Aug 30, 2024
2 parents 6c8f69b + 187a125 commit 4e5e79f
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is roughly based on [Keep a Changelog](https://keepachangelog.com/en/

<!-- start changelog -->

## 0.37.0

- move example configs inside package source tree ([#117](https://github.com/Open-EO/openeo-aggregator/issues/117))

## 0.36.0

- openeo.cloud configs: only consider "vito" for SENTINEL2_L2A collection ([#139](https://github.com/Open-EO/openeo-aggregator/issues/139))
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ RUN pip install --upgrade pip && \
pip install .


# TODO #117/#143 eliminate conf/gunicorn.prod.py reference
CMD ["gunicorn", "--config=conf/gunicorn.prod.py", "openeo_aggregator.app:create_app()"]
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ like command line options or env variables, as shown above.

### Gunicorn config

For gunicorn there are also configuration files in the `conf` folder.
The production docker based run for examples uses
For gunicorn there is an example config at `src/openeo_aggregator/config/examples/gunicorn-config.py`,
for example to be used like this:

gunicorn --config=conf/gunicorn.prod.py openeo_aggregator.app:create_app()
gunicorn --config=src/openeo_aggregator/config/examples/gunicorn-config.py openeo_aggregator.app:create_app()

### Application/Flask config

Expand All @@ -69,7 +69,7 @@ is grouped by an `AggregatorBackendConfig` container object
(subclass of `OpenEoBackendConfig` as defined in the `openeo-python-driver` framework project).
The most important config value is `aggregator_backends`, which
defines the backends to "aggregate".
See `src/openeo_aggregator/config.py` for more details and other available configuration options.
See `src/openeo_aggregator/config/config.py` for more details and other available configuration options.

The `conf` folder contains config files for the dev and production
variant of this application config:
Expand All @@ -78,11 +78,9 @@ variant of this application config:
- `conf/aggregator.prod.py`

Use the env var `OPENEO_BACKEND_CONFIG` to point to the desired config path.
By default, `conf/aggregator.dummy.py` is loaded.
For example, using the example dummy config from the repo:

For example, when using the Docker image, add something like this

-e OPENEO_BACKEND_CONFIG=/home/openeo/aggregator/conf/aggregator.dev.py
export OPENEO_BACKEND_CONFIG=src/openeo_aggregator/config/examples/aggregator.dummy.py

Also note that these concrete config files will be refactored out of the `openeo-aggregator` repo
at some point in the future ([#117](https://github.com/Open-EO/openeo-aggregator/issues/117))
Expand Down
1 change: 1 addition & 0 deletions conf/gunicorn.dev.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# See https://docs.gunicorn.org/en/stable/settings.html
# TODO #117 eliminate this file from this repository

bind = ["0.0.0.0:8080"]

Expand Down
1 change: 1 addition & 0 deletions conf/gunicorn.prod.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# See https://docs.gunicorn.org/en/stable/settings.html
# TODO #117 eliminate this file from this repository

bind = ["0.0.0.0:8080"]

Expand Down
2 changes: 1 addition & 1 deletion scripts/run-gunicorn.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

gunicorn --config=conf/gunicorn.dev.py 'openeo_aggregator.app:create_app()'
gunicorn --config=src/openeo_aggregator/config/examples/gunicorn-config.py 'openeo_aggregator.app:create_app()'
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@
url="https://github.com/Open-EO/openeo-aggregator",
packages=find_packages(where="src", include=["openeo_aggregator", "openeo_aggregator.*"]),
package_dir={"": "src"},
package_data={"openeo_aggregator": ["config/examples/*.py"]},
include_package_data=True,
data_files=[
(
"openeo-aggregator-data",
[
"CHANGELOG.md",
# TODO #117 eliminate gunicorn.dev.py reference
"conf/gunicorn.dev.py",
# TODO #117 eliminate gunicorn.prod.py reference
"conf/gunicorn.prod.py",
"conf/aggregator.dummy.py",
],
),
],
Expand Down
2 changes: 1 addition & 1 deletion src/openeo_aggregator/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
from typing import Optional

__version__ = "0.36.0a1"
__version__ = "0.37.0a1"


def log_version_info(logger: Optional[logging.Logger] = None):
Expand Down
12 changes: 12 additions & 0 deletions src/openeo_aggregator/config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from openeo_aggregator.config.config import (
CONNECTION_TIMEOUT_DEFAULT,
CONNECTION_TIMEOUT_INIT,
CONNECTION_TIMEOUT_JOB_LOGS,
CONNECTION_TIMEOUT_JOB_START,
CONNECTION_TIMEOUT_RESULT,
STREAM_CHUNK_SIZE_DEFAULT,
AggregatorBackendConfig,
ConfigException,
ProcessAllowed,
get_backend_config,
)
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions src/openeo_aggregator/config/examples/gunicorn-config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See https://docs.gunicorn.org/en/stable/settings.html

bind = ["0.0.0.0:8080"]

workers = 1
threads = 1

# Worker timeout
timeout = 60
2 changes: 1 addition & 1 deletion src/openeo_aggregator/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,6 @@ def config_overrides(**kwargs):
... def test_stuff():
"""
return openeo_driver.testing.config_overrides(
config_getter=openeo_aggregator.config._config_getter,
config_getter=openeo_aggregator.config.config._config_getter,
**kwargs,
)

0 comments on commit 4e5e79f

Please sign in to comment.