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

Get docker image working with latest gdal ubuntu #619

Merged
merged 5 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.8.5 as builder
FROM ghcr.io/osgeo/gdal:ubuntu-small-latest as builder

ENV DEBIAN_FRONTEND=noninteractive \
LC_ALL=C.UTF-8 \
Expand All @@ -18,9 +18,9 @@ RUN apt-get update && \

WORKDIR /build

RUN python3.10 -m pip --disable-pip-version-check -q wheel --no-binary psycopg2 psycopg2
RUN python3 -m pip --disable-pip-version-check -q wheel --no-binary psycopg2 psycopg2

FROM ghcr.io/osgeo/gdal:ubuntu-small-3.8.5
FROM ghcr.io/osgeo/gdal:ubuntu-small-latest

ENV DEBIAN_FRONTEND=noninteractive \
LC_ALL=C.UTF-8 \
Expand Down Expand Up @@ -48,7 +48,7 @@ RUN apt-get update && \
rm -rf /var/lib/{apt,dpkg,cache,log} && \
echo "Environment is: $ENVIRONMENT" && \
([ "$ENVIRONMENT" = "deployment" ] || \
pip install --disable-pip-version-check pip-tools pytest-cov)
pip install --disable-pip-version-check pip-tools pytest-cov --break-system-packages)

# Set up a nice workdir and add the live code
ENV APPDIR=/code
Expand All @@ -59,12 +59,12 @@ COPY . $APPDIR
# then we want to link the source (with the -e flag) and if we're in prod, we
# want to delete the stuff in the /code folder to keep it simple.
COPY --from=builder --link /build/*.whl ./
RUN python3.10 -m pip --disable-pip-version-check -q install *.whl && \
RUN python3 -m pip --disable-pip-version-check -q install *.whl --break-system-packages && \
rm *.whl && \
([ "$ENVIRONMENT" = "deployment" ] || \
pip --disable-pip-version-check install --editable .[$ENVIRONMENT]) && \
pip --disable-pip-version-check install --editable .[$ENVIRONMENT] --break-system-packages) && \
([ "$ENVIRONMENT" != "deployment" ] || \
(pip --no-cache-dir --disable-pip-version-check install .[$ENVIRONMENT] && \
(pip --no-cache-dir --disable-pip-version-check install .[$ENVIRONMENT] --break-system-packages && \
rm -rf /code/* /code/.git*)) && \
pip freeze && \
([ "$ENVIRONMENT" != "deployment" ] || \
Expand Down
22 changes: 4 additions & 18 deletions cubedash/summary/_stores.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
from geoalchemy2 import WKBElement
from geoalchemy2 import shape as geo_shape
from geoalchemy2.shape import from_shape, to_shape
from pygeofilter import ast
from pygeofilter.backends.evaluator import handle
from pygeofilter.backends.sqlalchemy.evaluate import SQLAlchemyFilterEvaluator
from pygeofilter.backends.sqlalchemy.evaluate import (
SQLAlchemyFilterEvaluator as FilterEvaluator,
)
from pygeofilter.parsers.cql2_json import parse as parse_cql2_json
from pygeofilter.parsers.cql2_text import parse as parse_cql2_text
from shapely.geometry.base import BaseGeometry
Expand All @@ -43,7 +43,6 @@
exists,
func,
literal,
null,
or_,
select,
union_all,
Expand Down Expand Up @@ -1267,7 +1266,7 @@ def _add_filter_to_query(
if filter_lang == "cql2-text"
else parse_cql2_json(filter_cql)
)
query = query.filter(FilterEvaluator(field_exprs).evaluate(filter_cql))
query = query.filter(FilterEvaluator(field_exprs, True).evaluate(filter_cql))

return query

Expand Down Expand Up @@ -1881,19 +1880,6 @@ def get_dataset_footprint_region(self, dataset_id):
)


class FilterEvaluator(SQLAlchemyFilterEvaluator):
"""
Since pygeofilter's SQLAlchemyFilterEvaluator doesn't support treating
invalid/undefined attributes as NULL as per the STAC API Filter spec,
this class overwrites the Evaluator's handling of attributes to return NULL
as the default value if a field is not present in the mapping of sqlalchemy expressions.
"""

@handle(ast.Attribute)
def attribute(self, node: ast.Attribute):
return self.field_mapping.get(node.name, null())


def _refresh_data(please_refresh: Set[PleaseRefresh], store: SummaryStore):
"""
Refresh product information after a schema update, plus the given kind of data.
Expand Down
12 changes: 6 additions & 6 deletions docs/rtd-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ datacube==1.8.18
dateparser==1.2.0
# via pygeofilter
defusedxml==0.7.1
# via datacube
deprecat==2.1.1
# via eodatasets3
deprecat==2.1.1
# via datacube
distributed==2023.1.1
# via datacube
eodatasets3==0.30.1
Expand Down Expand Up @@ -196,9 +196,9 @@ psutil==5.9.4
# via distributed
psycopg2==2.9.5
# via datacube
pygeofilter==0.2.1
pygeofilter==0.2.4
# via datacube-explorer (setup.py)
pygeoif==1.4.0
pygeoif==1.5.0
# via pygeofilter
pyorbital==1.7.3
# via datacube-explorer (setup.py)
Expand Down Expand Up @@ -241,7 +241,7 @@ referencing==0.32.0
# via
# jsonschema
# jsonschema-specifications
regex==2023.12.25
regex==2024.5.15
# via dateparser
requests==2.28.2
# via pyorbital
Expand Down Expand Up @@ -296,7 +296,7 @@ toolz==0.12.0
# partd
tornado==6.2
# via distributed
typing-extensions==4.11.0
typing-extensions==4.12.2
# via pygeoif
tzlocal==5.2
# via dateparser
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"sqlalchemy>=1.4",
"structlog>=20.2.0",
"pytz",
"pygeofilter",
"pygeofilter>=0.2.2",
],
tests_require=tests_require,
extras_require=extras_require,
Expand Down
Loading