-
Notifications
You must be signed in to change notification settings - Fork 0
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
lamba_chunk_video: Implemented the video chunk lambda and stack. #5
Conversation
logger = logging.getLogger() | ||
logger.setLevel(logging.INFO) | ||
logger.info('event parameter: {}'.format(event)) | ||
tmp_file_path = "/tmp/video.mp4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this generate a collision if two lambdas were executed at the same time?
tmp_file_path = "/tmp/video.mp4" | |
import uuid | |
tmp_file_path = "/tmp/video_" + uuid.uuid4().hex + ".mp4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @juanjoasensio-wizeline,
As far as I know the /tmp
folder is local to the lambda execution, so I think there is no issue with that.
@CesarReyes Please let me know in case I am wrong.
}); | ||
|
||
// Import the Raw Videos Bucket using its name | ||
const rawVideosBucketName = cdk.Fn.importValue('CommonRawVideosBucketName'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure you have the right lantern/indentation setup in your code editor, usually for TypeScript is two spaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @CesarReyes,
The indentation issue, was created when I pushed my changes.
This is how it looks on my VSCode:
00950cf
to
f5961a7
Compare
Implemented the chunk_video lambda and stack.
I was not able to find the way for adding the keys and values I need, on the event used to run the lambda on the stack, so please @CesarReyes take a look of it and if you can explain us how to do it it will be highly appreciated.
@ehdez-wizeline found the possibility of passing the values over the environment:
const dockerFunction = new lambda.DockerImageFunction(this, 'VideoChunkDockerFunction', { functionName: 'VideoChunkDockerFunction', code: lambda.DockerImageCode.fromImageAsset('../../../source/video_chunk_lambda'), memorySize: 1024, timeout: cdk.Duration.minutes(10), architecture: lambda.Architecture.ARM_64, environment: { SECRETS_NAME: CommonSecret.secretName, BUCKET_NAME: YOUR_BUCKET_NAME, ... } });
So maybe we can forget about the event object for that an modify the lambda to get the environment values for that purpose.
So please let us know what do you think about that as well.