Skip to content

Conversation

ojninja16
Copy link
Contributor

@ojninja16 ojninja16 commented Jan 31, 2025

  • Added SeBS version to Docker image tags
  • Included resource_id in function names for unique identification.
  • Updated default_function_name method across platforms to use resource_id.

Summary by CodeRabbit

Release Notes

  • Configuration

    • Added SeBS version identifier to system configuration.
  • Functionality

    • Enhanced function name generation across cloud platforms to include resource-specific identifiers.
    • Updated Docker image tagging to incorporate SeBS version information.
  • Versioning

    • Introduced SeBS version tracking in configuration and build processes.

Copy link

coderabbitai bot commented Jan 31, 2025

Walkthrough

This pull request introduces a new version tracking mechanism for the Serverless Benchmarking System (SeBS). Changes include the addition of a SeBS_version configuration key and modifications to function name generation across different cloud providers and deployment methods. The updates enhance the system's ability to uniquely identify and tag functions and Docker images by incorporating version and resource-specific identifiers.

Changes

File Change Summary
config/systems.json Added "SeBS_version": "1.1.0" under the "general" section
sebs.py Updated default_function_name() to include resource configuration
sebs/aws/aws.py Modified function name generation to include resources.resources_id
sebs/config.py Enhanced image tag generation to include SeBS version
sebs/gcp/gcp.py Updated function name generation with resource identifiers
sebs/local/local.py Modified function name generation to include resources_id
sebs/openwhisk/openwhisk.py Added resource-based function name generation
tools/build_docker_images.py Incorporated SeBS version in Docker image tagging
sebs/azure/azure.py Updated function name generation to include resource identifiers
sebs/faas/system.py Added optional resources parameter to function name generation

Suggested reviewers

  • mcopik

Poem

🐰 A Rabbit's Versioning Tale
In configs and clouds, a version takes flight,
SeBS now tracks its journey with digital might.
Resources and tags, a harmonious song,
Benchmarking systems, no longer go wrong!
🚀 Version 1.1.0, hop hop hooray! 🎉

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
config/systems.json (1)

3-4: Consider using environment variables for versioning.

While adding versioning is good, hardcoding the version in the config file may lead to version drift. Consider:

  1. Using environment variables for the version.
  2. Adding a VERSION file at the root of the project.
  3. Using git tags for version tracking.

This would make version management more maintainable and automated.

sebs/gcp/gcp.py (1)

107-111: LGTM! Consider these minor improvements.

The changes align well with the PR objectives. Two suggestions to improve the code:

  1. Consider using named placeholders for better readability
  2. Consider converting this to an instance method since it uses an instance parameter
-    @staticmethod
-    def default_function_name(code_package: Benchmark,resources:Resources) -> str:
-        # Create function name
-        func_name = "{}-{}-{}-{}".format(
-            code_package.benchmark, code_package.language_name, code_package.language_version,resources.resources_id
-        )
+    def default_function_name(self, code_package: Benchmark, resources: Resources) -> str:
+        # Create function name
+        func_name = "{benchmark}-{lang}-{ver}-{res_id}".format(
+            benchmark=code_package.benchmark,
+            lang=code_package.language_name,
+            ver=code_package.language_version,
+            res_id=resources.resources_id
+        )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0478b79 and 76fc6e7.

📒 Files selected for processing (8)
  • config/systems.json (1 hunks)
  • sebs.py (1 hunks)
  • sebs/aws/aws.py (1 hunks)
  • sebs/config.py (1 hunks)
  • sebs/gcp/gcp.py (1 hunks)
  • sebs/local/local.py (2 hunks)
  • sebs/openwhisk/openwhisk.py (2 hunks)
  • tools/build_docker_images.py (1 hunks)
🔇 Additional comments (8)
sebs/config.py (1)

93-95: LGTM! Good use of dict.get() with default value.

The implementation safely handles missing version information by defaulting to "unknown".

tools/build_docker_images.py (1)

40-41: LGTM! Consistent with config.py implementation.

The implementation maintains consistency with config.py by using the same default value and version retrieval method.

sebs/local/local.py (2)

20-20: LGTM!

The import of Resources from sebs.faas.config is correctly added to support the new resource ID functionality.


345-349: LGTM! Function name generation enhanced with resource ID.

The function name format now includes the resource ID, which improves uniqueness and traceability of deployed functions.

sebs/openwhisk/openwhisk.py (2)

15-15: LGTM!

The import of Resources from sebs.faas.config is correctly added to support the new resource ID functionality.


Line range hint 392-399: LGTM! Function name generation enhanced with resource ID.

The function name format now includes the resource ID, which improves uniqueness and traceability of deployed functions.

sebs.py (1)

496-496: LGTM! Function call updated to include resource configuration.

The call to default_function_name is correctly updated to pass the required resource configuration.

sebs/aws/aws.py (1)

392-401: LGTM! Function name generation enhanced with resource ID and AWS-specific formatting.

The function name format now includes the resource ID and maintains AWS Lambda naming restrictions by replacing hyphens and dots with underscores.

@ojninja16
Copy link
Contributor Author

hi @mcopik please review this PR

Copy link
Collaborator

@mcopik mcopik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a minor thing - please do code linting with our tool :)

@mcopik
Copy link
Collaborator

mcopik commented Feb 5, 2025

Very nice work! Almost ready to merge :)

@ojninja16 ojninja16 requested a review from mcopik February 5, 2025 14:36
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
sebs/faas/system.py (1)

379-381: Add docstring to document the new parameter.

The method lacks documentation for the new resources parameter. Add a docstring to explain its purpose and usage.

     @abstractmethod
     def default_function_name(
         self, code_package: Benchmark, resources: Optional[Resources] = None
     ) -> str:
+        """
+        Generate a default name for the function.
+
+        Args:
+            code_package: Benchmark containing the function code
+            resources: Optional resources configuration containing resource_id
+
+        Returns:
+            str: Generated function name
+        """
         pass
sebs/azure/azure.py (2)

192-193: Consider implementing other trigger types.

The TODO comment indicates that only HTTP triggers are supported. Consider implementing other common trigger types like timer, queue, or blob triggers to enhance the functionality.

Would you like me to help implement support for additional trigger types? I can create a new issue to track this enhancement.


520-520: Consider implementing memory metrics collection.

The TODO comment indicates missing memory metrics collection. This could be valuable for benchmarking purposes.

Would you like me to help implement the memory metrics collection using Azure Monitor metrics API? I can create a new issue to track this enhancement.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 76fc6e7 and 3f3f5a3.

📒 Files selected for processing (7)
  • sebs/aws/aws.py (1 hunks)
  • sebs/azure/azure.py (2 hunks)
  • sebs/config.py (2 hunks)
  • sebs/faas/system.py (1 hunks)
  • sebs/gcp/gcp.py (1 hunks)
  • sebs/local/local.py (2 hunks)
  • sebs/openwhisk/openwhisk.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • sebs/aws/aws.py
  • sebs/config.py
  • sebs/local/local.py
  • sebs/openwhisk/openwhisk.py
  • sebs/gcp/gcp.py
🔇 Additional comments (5)
sebs/faas/system.py (2)

379-381: Method signature change requires updates to all implementing classes.

The addition of the optional resources parameter to default_function_name requires updates to all concrete subclasses implementing this abstract method. This change aligns with the PR objective of incorporating resource_id in function names for better identification.

Let's verify that all implementing classes have been updated accordingly:


254-269: Verify the impact on existing function name generation.

The get_function method calls default_function_name without providing the resources parameter. This needs to be verified to ensure it doesn't affect existing functionality.

Let's check if there are any other callers of this method that might need updating:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Find all calls to default_function_name to ensure they're updated
# with the new parameter if needed.

ast-grep --pattern 'default_function_name($$$)'

Length of output: 49


🏁 Script executed:

#!/bin/bash
# Let's search for the definition of default_function_name to inspect its signature.
echo "Searching for default_function_name definitions:"
rg "def default_function_name" -n .

# Now, let's search for all calls to default_function_name to see their usage.
echo "Searching for calls to default_function_name:"
rg "default_function_name(" -n .

Length of output: 811


🏁 Script executed:

#!/bin/bash
# Show the definition of default_function_name in sebs/faas/system.py to inspect its parameters.
sed -n '375,400p' sebs/faas/system.py

Length of output: 680


The default_function_name call in get_function is safe as written.

  • The method’s signature defines resources as an optional parameter with a default value of None, so omitting it has no impact on functionality.
  • No other call sites indicate that the resources parameter is required.
sebs/azure/azure.py (3)

22-22: LGTM! Import added for new Resources type.

The import of Resources from sebs.faas.config aligns with the PR objectives of adding resource_id support.


326-328: LGTM! Method signature updated to support resource identification.

The addition of the optional resources parameter maintains backward compatibility while enabling resource-specific function naming.


332-342: Verify resource_id usage in function naming.

The function name generation includes self.config.resources.resources_id which aligns with the PR objectives. However, the provided resources parameter is not being used.

Let's verify if this is intentional by checking other cloud provider implementations:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Search for other implementations of default_function_name
ast-grep --pattern 'def default_function_name($_, $resources: Optional[Resources] = None) -> str {
  $$$
}'

Length of output: 109


I'll gather further evidence to see if any other cloud provider implementation uses a different approach for generating the default function name. Let's search for occurrences of the default_function_name definition in the repository using a plain-text search.


🏁 Script executed:

#!/bin/bash
rg "def default_function_name" -n .

Length of output: 473


I'll compare the Azure implementation with another cloud provider implementation (AWS) to determine whether omitting the resources parameter is intentional. Let's review the AWS implementation for context.


🏁 Script executed:

#!/bin/bash
rg -C 10 "def default_function_name" sebs/aws/aws.py

Length of output: 887


I'll gather additional context from another cloud provider—GCP—to see how they handle the resources parameter in naming.


🏁 Script executed:

#!/bin/bash
rg -C 10 "def default_function_name" sebs/gcp/gcp.py

Length of output: 831


Resource ID Usage in Azure Default Function Naming is Intentional
In Azure’s implementation, the method always obtains the resource ID from self.config.resources rather than from the provided resources parameter. This is in contrast with the AWS and GCP implementations—which are static methods and conditionally use the passed resources if available—but appears to be an intentional design decision for Azure to reference its instance configuration directly.

@ojninja16
Copy link
Contributor Author

hi @mcopik I have made the changes please review the required changes

@mcopik
Copy link
Collaborator

mcopik commented Feb 20, 2025

Hi @ojninja16

I just tested the PR and I'm not sure it works as expected. This command

./sebs.py benchmark invoke 210.thumbnailer test --config config/\example.json --deployment aws --verbose --language-version 3.9

It created the function as expected but it add resource_id to the name. See the cache entry:

      "functions": {
        "210_thumbnailer_python_3_9_x64": {
          "arn": "X",
          "benchmark": "210.thumbnailer",
          "bucket": null,
          "config": {
            "architecture": "x64",
            "memory": 256,
            "runtime": {
              "language": "python",
              "version": "3.9"
            },
            "timeout": 60
          },
          "hash": "d958c638d474e1ff00117d6d61c6b917",
          "name": "210_thumbnailer_python_3_9_x64",
          "role": "X",
          "runtime": "3.9",
          "triggers": [
            {
              "name": "210_thumbnailer_python_3_9_x64",
              "type": "Library"
            },
            {
              "api-id": "X",
              "type": "HTTP",
              "url": "X"
            }
          ]
        }
      }

@ojninja16
Copy link
Contributor Author

Hi @mcopik hope you are doing good, my understanding was that the requirement of the issue was to append the resource_id to the function names, was the expectation different? Please let me know I will make changes according to that

@mcopik
Copy link
Collaborator

mcopik commented Feb 21, 2025

@ojninja16 Exactly, but I can't find the resource_id in the function name :-) It only has language, language version and architecture.

@ojninja16
Copy link
Contributor Author

@mcopik that's weird. I will check for all the platforms once and make the necessary changes to make it work

@mcopik
Copy link
Collaborator

mcopik commented Feb 21, 2025

@ojninja16 Maybe the condition for resources malfunctioned :) I just started a first invocation from a clean cache.

On a related note, would it be possible to change the function name template to: sebs-{resource-id}-210_thumbnailer_python_3_9_x64 instead of adding resource id as a suffix? I'm working concurrently on resource management, and I realized that having this as prefix will significantly improve cleanup and finding all resources.

@ojninja16
Copy link
Contributor Author

@mcopik so did it work?.Yeah that should not be an issue , I will do that🙂

@mcopik
Copy link
Collaborator

mcopik commented Feb 21, 2025

@ojninja16 Invocation worked but the function didn't have the resource id in its name :)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
sebs/aws/aws.py (1)

393-393: Fix missing space after comma in function parameter.

There's a minor formatting issue - missing space after the comma between parameters.

-        self,code_package: Benchmark, resources: Optional[Resources] = None
+        self, code_package: Benchmark, resources: Optional[Resources] = None
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3f3f5a3 and 691d5f2.

📒 Files selected for processing (2)
  • sebs/aws/aws.py (1 hunks)
  • sebs/gcp/gcp.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • sebs/gcp/gcp.py
🔇 Additional comments (1)
sebs/aws/aws.py (1)

393-394:

❓ Verification inconclusive

Verify resource_id implementation across all platforms.

Ensure that this change is consistently implemented across all platforms (GCP, Local, OpenWhisk, Azure, System) as mentioned in the PR objectives to maintain uniformity in resource identification.


🏁 Script executed:

#!/bin/bash
# Check if the resource_id implementation is consistent across all platforms
echo "Checking resource_id implementation across platforms..."
echo "AWS implementation:"
rg -A 15 "default_function_name" sebs/aws/aws.py

echo "\nGCP implementation:"
rg -A 15 "default_function_name" sebs/gcp/gcp.py

echo "\nLocal implementation:"
rg -A 15 "default_function_name" sebs/local/local.py

echo "\nOpenWhisk implementation:"
rg -A 15 "default_function_name" sebs/openwhisk/openwhisk.py

echo "\nAzure implementation:"
rg -A 15 "default_function_name" sebs/azure/azure.py

echo "\nSystem implementation:"
rg -A 15 "default_function_name" sebs/faas/system.py

Length of output: 4975


Verify Resource ID Implementation Consistency Across All Platforms

I've verified that the implementations for generating the function name use the resources_id differently across platforms:

  • AWS, GCP, and Azure:
    They obtain the resource identifier directly via self.config.resources.resources_id in the format string.

  • Local and OpenWhisk:
    They conditionally use the resources parameter (i.e. resources.resources_id) when provided, falling back to a version that omits it if not.

  • System:
    The implementation remains abstract, which is expected.

Please confirm that this variance is intentional per the PR objectives. If a uniform approach is required, the Local and OpenWhisk implementations may need to be adjusted for consistency.

@ojninja16
Copy link
Contributor Author

@mcopik I have made the changes for the fix please test it if the resource Id is being added to the name and added the resource Id in the prefix instead of suffix .

@mcopik
Copy link
Collaborator

mcopik commented Mar 5, 2025

@ojninja16 I just tested this and it's almost perfect :D Thank you!

Two last minor corrections:

  • Example function name for me is 1ab65e58_210_thumbnailer_python_3_8_x64_docker. Can we add sebs at the front?, e.g. sebs_1ab65e58_210_thumbnailer_python_3_8_x64_docker?
  • Container name is sebs-benchmarks-1ab65e58:function.aws.210.thumbnailer.python-3.8-x64.1.1.0. Can we add a hyphen instead of dot between architecture and version, e.g., sebs-benchmarks-1ab65e58:function.aws.210.thumbnailer.python-3.8-x64-1.1.0? Otherwise, it will be difficult to parse it automatically - now you can just split it on - to separate the string into [function, language version, architecture, sebs version].

As soon as this is done then we can merge :)

@ojninja16
Copy link
Contributor Author

@mcopik glad it worked finally 😅! Yeah sure I will make those changes and let you know

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
sebs/gcp/gcp.py (1)

111-111: Consider adding a null check for resources.

The code assumes that either resources or self.config.resources will be non-None. While this might be handled elsewhere in the codebase, it's safer to add a null check to prevent potential AttributeError exceptions.

-        resource_id = resources.resources_id if resources else self.config.resources.resources_id
+        resource_id = resources.resources_id if resources else (self.config.resources.resources_id if self.config.resources else "default")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 051c611 and 21529c1.

📒 Files selected for processing (6)
  • sebs/aws/aws.py (1 hunks)
  • sebs/azure/azure.py (2 hunks)
  • sebs/config.py (2 hunks)
  • sebs/gcp/gcp.py (1 hunks)
  • sebs/local/local.py (2 hunks)
  • sebs/openwhisk/openwhisk.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • sebs/openwhisk/openwhisk.py
  • sebs/azure/azure.py
  • sebs/aws/aws.py
  • sebs/config.py
  • sebs/local/local.py
🔇 Additional comments (2)
sebs/gcp/gcp.py (2)

112-117: Function name format aligns with PR requirements.

The function name now includes the resource_id as a prefix, which matches the requirement mentioned in the PR comments to "prefix the resource_id to the function name instead of being added as a suffix". This will help with resource management and cleanup processes.


106-118:

❓ Verification inconclusive

Correct implementation of the resource_id prefix in function names.

The modification correctly changes the default_function_name method to add the resource_id as a prefix to the function name, which aligns with the PR objective. The method now accepts an optional resources parameter and falls back to self.config.resources.resources_id if not provided.

However, let's verify that all calls to this method have been updated since it's no longer a static method:


🏁 Script executed:

#!/bin/bash
# Description: Find all calls to GCP.default_function_name that need to be updated

# Search for static method calls that need to be changed
rg "GCP\.default_function_name" --type py

Length of output: 43


Attention: Confirm Call Site Updates for default_function_name

The updated default_function_name method in sebs/gcp/gcp.py correctly uses the instance (via self) to derive the resource_id. Our search for static calls using the pattern "GCP.default_function_name" produced no results, which suggests that the older static invocation pattern has been removed. However, since the search output is limited, please manually verify that all instances calling this method in the codebase are updated to use the instance form.

  • Confirm that no remaining static calls (e.g., GCP.default_function_name(...)) exist.
  • Double-check any call sites that invoke default_function_name (likely as an instance method) to ensure they work as expected.

@ojninja16
Copy link
Contributor Author

Hi @mcopik, I’ve made the changes as you suggested! Looking forward to seeing the PR merged 😄

@mcopik mcopik merged commit 62eaccc into spcl:master Mar 6, 2025
@mcopik
Copy link
Collaborator

mcopik commented Mar 6, 2025

Thank you @ojninja16, great work!!

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.

2 participants