Skip to content

Commit

Permalink
Make the deploy work
Browse files Browse the repository at this point in the history
  • Loading branch information
devinmatte committed Apr 7, 2024
1 parent 30af64c commit 6f98909
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 10 deletions.
46 changes: 40 additions & 6 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,50 @@ poetry run chalice package --stage prod --merge-template .chalice/resources.json
echo "Shrinking the deployment package for the lambda layer"

zip -d -qq cfn/layer-deployment.zip '*/__pycache__/*'
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/*.dist-info/**/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/*.dist-info/*
zip -d -qq cfn/layer-deployment.zip '**/*.pyc'
zip -d -qq cfn/layer-deployment.zip '**/LICENSE*'
zip -d -qq cfn/layer-deployment.zip '**/AUTHOR*'
zip -d -qq cfn/layer-deployment.zip '**/NOTICE*'
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/numpy*/tests/**/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/pandas*/tests/**/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/pyarrow*/tests/**/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/**/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/docs/**/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/examples/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/a*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/b*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/co*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/ch*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/cu*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/da*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/di*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/do*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/de*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/e*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/f*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/g*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/h*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/i*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/j*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/k*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/l*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/m*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/n*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/o*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/p*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/q*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/r*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/sa*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/se*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/ss*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/t*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/u*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/v*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/w*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/x*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/y*/*
zip -d -qq cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto*/data/z*/*

# Check package size before deploying
maximumsize=80000000
Check package size before deploying
maximumsize=79100000
actualsize=$(wc -c <"cfn/layer-deployment.zip")
if [ $actualsize -ge $maximumsize ]; then
echo ""
Expand Down
8 changes: 4 additions & 4 deletions ingestor/chalicelib/lamp/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import pandas as pd

from .utils import format_dateint, get_current_service_date
from ..parallel import make_parallel
from ..s3 import upload_df_as_csv
from .. import parallel
from .. import s3


LAMP_INDEX_URL = "https://performancedata.mbta.com/lamp/subway-on-time-performance-v1/index.csv"
Expand Down Expand Up @@ -128,11 +128,11 @@ def upload_to_s3(stop_id_and_events: Tuple[str, pd.DataFrame], service_date: dat
# Upload to s3 as csv
s3_key = S3_KEY_TEMPLATE.format(stop_id=stop_id, YYYY=service_date.year, _M=service_date.month, _D=service_date.day)
# _local_save(s3_key, stop_events)
upload_df_as_csv(S3_BUCKET, s3_key, stop_events)
s3.upload_df_as_csv(S3_BUCKET, s3_key, stop_events)
return [stop_id]


_parallel_upload = make_parallel(upload_to_s3)
_parallel_upload = parallel.make_parallel(upload_to_s3)


def ingest_lamp_data():
Expand Down

0 comments on commit 6f98909

Please sign in to comment.