Skip to content
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

Merged
merged 3 commits into from
Aug 7, 2024

Conversation

jabe-wizeline
Copy link
Collaborator

@jabe-wizeline jabe-wizeline commented Jul 26, 2024

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.

logger = logging.getLogger()
logger.setLevel(logging.INFO)
logger.info('event parameter: {}'.format(event))
tmp_file_path = "/tmp/video.mp4"
Copy link
Collaborator

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?

Suggested change
tmp_file_path = "/tmp/video.mp4"
import uuid
tmp_file_path = "/tmp/video_" + uuid.uuid4().hex + ".mp4"

Copy link
Collaborator Author

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');
Copy link
Collaborator

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

Copy link
Collaborator Author

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:
Screenshot 2024-07-31 at 09 15 00

@ehdez-wizeline ehdez-wizeline merged commit fc92473 into main Aug 7, 2024
@ehdez-wizeline ehdez-wizeline deleted the feat/lambda_chunk_video branch August 20, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants