dabruhce / python-opencv-ffmpeg-lambda

0 stars 0 forks source link

size limitation #1

Open dabruhce opened 7 years ago

dabruhce commented 7 years ago

after packaging this up for lambda execution its too large to execute The Code tab failed to save. Reason: Unzipped size must be smaller than 262144000 bytes

dabruhce commented 7 years ago

Need to break this up and load the libraries at runtime into tmp:

create lib.zip, store in s3

import boto
from boto.s3.connection import S3Connection
import zipfile

#keys/vars

aws_connection = S3Connection(AWS_KEY, AWS_SECRET)
bucket = aws_connection.get_bucket(BUCKET)

key = bucket.get_key('lib.zip')
key.get_contents_to_filename('/tmp/lib.zip')

zip_ref = zipfile.ZipFile('/tmp/lib.zip', 'r')
zip_ref.extractall('/tmp/lib/.')
zip_ref.close()

set lambda function env variable LD_LIBRARY_PATH to /tmp/lib

Need to wrap executing script with command


command = 'LD_LIBRARY_PATH={} python {}/app2.py'.format(
        LIB_DIR,
        TASK_DIR,
    )