Skip to content

Commit dc9af6a

Browse files
refactor xarray application (#1231)
* refactor xarray application * update lambda handler * update lambda
1 parent 7a3b907 commit dc9af6a

File tree

12 files changed

+689
-94
lines changed

12 files changed

+689
-94
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ jobs:
3535
with:
3636
python-version: ${{ matrix.python-version }}
3737

38-
# - name: Configure AWS credentials
39-
# uses: aws-actions/configure-aws-credentials@v5
40-
# with:
41-
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
42-
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
43-
# aws-region: us-east-1
44-
4538
- name: Install dependencies
4639
run: |
4740
python -m pip install --upgrade pip

deployment/aws/lambda/Dockerfile.xarray

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ WORKDIR /tmp
88
RUN dnf install -y gcc-c++ && dnf clean all
99

1010
RUN python -m pip install pip -U
11-
RUN python -m pip install "titiler.xarray==0.23.1" "mangum>=0.10.0" "aiobotocore==2.17.0" "zarr" "s3fs" "aiohttp" "h5netcdf" "starlette-cramjam" "cftime" -t /asset --no-binary pydantic,xarray,numpy,pandas
11+
RUN python -m pip install "titiler.xarray==0.23.1" "mangum>=0.10.0" "aiobotocore==2.17.0" "zarr" "s3fs" "aiohttp" "h5netcdf" "starlette-cramjam" "pydantic-settings" "cftime" -t /asset --no-binary pydantic,xarray,numpy,pandas
1212

1313
# Reduce package size and remove useless files
1414
RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[0-9]*//'); cp $f $n; done;
@@ -18,11 +18,13 @@ RUN find /asset -type d -a -name 'tests' -print0 | xargs -0 rm -rf
1818
RUN rm -rdf /asset/numpy/doc/ /asset/boto3* /asset/botocore* /asset/bin /asset/geos_license /asset/Misc
1919

2020
COPY lambda/xarray_handler.py /asset/handler.py
21+
COPY lambda/templates/ /asset/templates
2122

2223
# Ref: https://github.com/developmentseed/titiler/discussions/1108#discussioncomment-13045681
2324
RUN cp /usr/lib64/libexpat.so.1 /asset/
2425

2526
WORKDIR /asset
27+
2628
RUN python -c "from handler import handler; print('All Good')"
2729

2830
CMD ["echo", "hello world"]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{% include "header.html" %}
2+
{% if params %}
3+
{% set urlq = url + '?' + params + '&' %}
4+
{% else %}
5+
{% set urlq = url + '?' %}
6+
{% endif %}
7+
8+
<nav aria-label="breadcrumb">
9+
<ol class="breadcrumb bg-light">
10+
{% for crumb in crumbs %}
11+
{% if not loop.last %}
12+
<li class="breadcrumb-item"><a href="{{ crumb.url }}/">{{ crumb.part }}</a></li>
13+
{% else %}<li class="breadcrumb-item active" aria-current="page">{{ crumb.part }}</li>
14+
{% endif %}
15+
{% endfor %}
16+
17+
<li class="ml-auto json-link"><a target="_blank" href="{{ urlq }}f=json">JSON</a></li>
18+
</ol>
19+
</nav>
20+
21+
<h1>{{ template.title }}</h1>
22+
23+
<p>This API implements the conformance classes from standards and community specifications that are listed below.</p>
24+
25+
<h2>Links</h2>
26+
<ul>
27+
{% for url in response.conformsTo %}
28+
<li> <a target="_blank" href="{{ url }}">{{ url }}</a></li>
29+
{% endfor %}
30+
</ul>
31+
32+
{% include "footer.html" %}

deployment/aws/lambda/templates/header.html

Lines changed: 44 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{% include "header.html" %}
2+
{% if params %}
3+
{% set urlq = url + '?' + params + '&' %}
4+
{% else %}
5+
{% set urlq = url + '?' %}
6+
{% endif %}
7+
8+
<nav aria-label="breadcrumb">
9+
<ol class="breadcrumb bg-light">
10+
{% for crumb in crumbs %}
11+
{% if not loop.last %}
12+
<li class="breadcrumb-item"><a href="{{ crumb.url }}/">{{ crumb.part }}</a></li>
13+
{% else %}<li class="breadcrumb-item active" aria-current="page">{{ crumb.part }}</li>
14+
{% endif %}
15+
{% endfor %}
16+
17+
<li class="ml-auto json-link"><a target="_blank" href="{{ urlq }}f=json">JSON</a></li>
18+
</ol>
19+
</nav>
20+
21+
<h1>{{ response.title }}</h1>
22+
<p>
23+
{{ response.description }}
24+
</p>
25+
26+
<pre>
27+
______ __ ______ __ __ ______ ______
28+
/\__ _\ /\ \ /\__ _\ /\ \ /\ \ /\ ___\ /\ == \
29+
\/_/\ \/ \ \ \ \/_/\ \/ \ \ \ \ \ \____ \ \ __\ \ \ __<
30+
\ \_\ \ \_\ \ \_\ \ \_\ \ \_____\ \ \_____\ \ \_\ \_\
31+
\/_/ \/_/ \/_/ \/_/ \/_____/ \/_____/ \/_/ /_/
32+
33+
</pre>
34+
35+
<h2>Links</h2>
36+
<ul>
37+
{% for link in response.links %}
38+
<li> <a href="{{ link.href }}">{{ link.title or link.rel }}</a></li>
39+
{% endfor %}
40+
</ul>
41+
42+
{% include "footer.html" %}

0 commit comments

Comments
 (0)