Skip to content

Refactor deploying image logic #346

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Haivilo
Copy link

@Haivilo Haivilo commented Apr 12, 2025

TODO

Fix integration tests

Summary of Changes

  1. Image Mapping Changed from Per-Function to Per-Workflow

    • The deployment logic was simplified to store a single image URI per workflow_instance_id instead of per function.
  2. Introduced Generic Lambda Handler

    • Added generic_handler.py, a dynamic entrypoint that routes invocations based on the target field in the event payload.
  3. Payload Format Enhancement

    • Payloads now include a top-level "target" field indicating the function name to invoke, to support the generic Lambda handler.
  4. Minor Enhancements

    • Docker image names now use workflow_instance_id instead of full function name.
    • _copy_image_to_region was renamed to _copy_image_if_not_exists and now avoids redundant ECR operations when the image exists in the same region.

Haivilo added 3 commits March 31, 2025 13:10
…ing and function registration

- Changed `_copy_image_to_region` to `_copy_image_if_not_exists` and modified logic
- Added logic to skip image copying if it already exists in the current region.
- Updated Docker image naming to use `workflow_instance_id`, so every lambda function uses the same docker image.
- Introduced `set_wrapped_function` method in `CaribouFunction` to register wrapped functions.
- Enhanced `CaribouWorkflow` to pass `successor_function_name` in various methods for better tracking.
- Added a new `generic_handler.py` to handle dynamic function routing in Lambda.
- Updated deployment packager to include the new generic handler.
- Adjusted tests to reflect changes in image copying logic.
@engshahrad engshahrad requested a review from Danidite April 15, 2025 19:11
@engshahrad engshahrad added the enhancement New feature or request label Apr 15, 2025
@engshahrad
Copy link
Contributor

@Haivilo for the sake of documentation, can you provide details on performance gains as a result of this change in a comment?

@Danidite and @vGsteiger can you engage with Steve to fix rough edges and bring the new capability to the project? Thanks

@Haivilo
Copy link
Author

Haivilo commented Apr 15, 2025

Hi @engshahrad, the build time improves as the number of functions increase, which reaches ~50% reduction when you have 5 workflow functions. This was tested locally. Here is the improvement of example build time:
output

For the performance related to migrating speed, I will discuss with @Danidite and get back to you. I was unable to retrieve the results efficiently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants