Skip to content

Commit

Permalink
api: keep formulae.json in repo
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Sep 16, 2020
1 parent a8c2083 commit aafc717
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.json.gz filter=lfs diff=lfs merge=lfs -text
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ mpcontribs-api/mpcontribs/api/swagger/
.jupyter/
.local/
mpcontribs-portal/mpcontribs/portal/templates/notebooks
formulae.json
coverage.xml
8 changes: 1 addition & 7 deletions cloudformation/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ Parameters:
Type: String
SnsAdminTopicArn:
Type: String
MapiKey:
NoEcho: 'true'
Type: String
Description: API key for MPRester to build formulae lookup table
DdApiKey:
NoEcho: 'true'
Type: String
Expand Down Expand Up @@ -427,7 +423,7 @@ Resources:
build:
commands:
- docker build --tag "${IMAGE_URI}-portal" mpcontribs-portal
- docker build --tag "${IMAGE_URI}-api" --build-arg MAPI_KEY=${MAPI_KEY} mpcontribs-api
- docker build --tag "${IMAGE_URI}-api" mpcontribs-api
- docker build --tag "${IMAGE_URI}-gateway" mpcontribs-sidecars/kernel_gateway
- docker build --tag "${IMAGE_URI}-orca" mpcontribs-sidecars/orca
- docker build --tag "${IMAGE_URI}-datadog" mpcontribs-sidecars/datadog-agent
Expand All @@ -454,8 +450,6 @@ Resources:
Value: !Sub ${Repository}
- Name: PREFIX
Value: !Sub ${PipelineName}-${EnvironmentName}
- Name: MAPI_KEY
Value: !Ref 'MapiKey'
Cache:
Type: LOCAL
Modes: # You can specify one or more cache mode,
Expand Down
5 changes: 0 additions & 5 deletions mpcontribs-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ RUN pip install $PIP_FLAGS -e .
#RUN cd flask-mongorest && pip install $PIP_FLAGS -e .
#RUN cd flasgger && pip install $PIP_FLAGS -e .

ARG MAPI_KEY
RUN if [ ! -e /app/mpcontribs/api/contributions/formulae.json ]; then \
python /app/mpcontribs/api/contributions/generate_formulae.py 2>&1; \
fi

FROM base
COPY --from=builder /root/.local/lib/python3.8/site-packages /root/.local/lib/python3.8/site-packages
COPY --from=builder /root/.local/bin /root/.local/bin
Expand Down
9 changes: 6 additions & 3 deletions mpcontribs-api/mpcontribs/api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
import os
import datetime
import json
import gzip

with open(
os.path.join(os.path.dirname(__file__), "contributions", "formulae.json")
) as f:
formulae_path = os.path.join(
os.path.dirname(__file__), "contributions", "formulae.json.gz"
)

with gzip.open(formulae_path) as f:
FORMULAE = json.load(f)

DEBUG = bool(os.environ.get("FLASK_ENV") == "development")
Expand Down
3 changes: 3 additions & 0 deletions mpcontribs-api/mpcontribs/api/contributions/formulae.json.gz
Git LFS file not shown

0 comments on commit aafc717

Please sign in to comment.