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

Add versioning and resource_id to function names(#230) #232

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config/systems.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"general": {
"docker_repository": "spcleth/serverless-benchmarks"
"docker_repository": "spcleth/serverless-benchmarks",
"SeBS_version": "1.1.0"
},
"local": {
"experiments": {
Expand Down
2 changes: 1 addition & 1 deletion sebs.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def start(

for i in range(deployments):
func = deployment_client.get_function(
benchmark_obj, deployment_client.default_function_name(benchmark_obj)
benchmark_obj, deployment_client.default_function_name(benchmark_obj,deployment_client.config.resources)
)
result.add_function(func)

Expand Down
5 changes: 3 additions & 2 deletions sebs/aws/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,14 @@ def update_function_configuration(self, function: Function, benchmark: Benchmark
self.logging.info(f"Updated configuration of {function.name} function. ")

@staticmethod
def default_function_name(code_package: Benchmark) -> str:
def default_function_name(code_package: Benchmark,resources:Resources) -> str:
# Create function name
func_name = "{}-{}-{}-{}".format(
func_name = "{}-{}-{}-{}-{}".format(
code_package.benchmark,
code_package.language_name,
code_package.language_version,
code_package.architecture,
resources.resources_id
)
if code_package.container_deployment:
func_name = f"{func_name}-docker"
Expand Down
4 changes: 3 additions & 1 deletion sebs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def benchmark_image_tag(
tag = f"function.{system}.{benchmark}.{language_name}-{language_version}-{architecture}"
if self.image_tag_prefix:
tag = f"{tag}-{self.image_tag_prefix}"
return tag
sebs_version=self._system_config["general"].get("SeBS_version", "unknown")
tag=f"{tag}.{sebs_version}"
return tag

def username(self, deployment_name: str, language_name: str) -> str:
return self._system_config[deployment_name]["languages"][language_name]["username"]
6 changes: 3 additions & 3 deletions sebs/gcp/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ def get_storage(
return self.storage

@staticmethod
def default_function_name(code_package: Benchmark) -> str:
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
func_name = "{}-{}-{}-{}".format(
code_package.benchmark, code_package.language_name, code_package.language_version,resources.resources_id
)
return GCP.format_function_name(func_name)

Expand Down
8 changes: 4 additions & 4 deletions sebs/local/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from sebs.faas.function import Function, FunctionConfig, ExecutionResult, Trigger
from sebs.faas.storage import PersistentStorage
from sebs.faas.system import System
from sebs.faas.config import Resources
from sebs.benchmark import Benchmark


Expand Down Expand Up @@ -341,11 +342,10 @@ def enforce_cold_start(self, functions: List[Function], code_package: Benchmark)
raise NotImplementedError()

@staticmethod
def default_function_name(code_package: Benchmark) -> str:
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
)
func_name = "{}-{}-{}-{}".format(
code_package.benchmark, code_package.language_name, code_package.language_version,resources.resources_id)
return func_name

@staticmethod
Expand Down
5 changes: 3 additions & 2 deletions sebs/openwhisk/openwhisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from sebs.openwhisk.storage import Minio
from sebs.openwhisk.triggers import LibraryTrigger, HTTPTrigger
from sebs.utils import LoggingHandlers
from sebs.faas.config import Resources
from .config import OpenWhiskConfig
from .function import OpenWhiskFunction, OpenWhiskFunctionConfig
from ..config import SeBSConfig
Expand Down Expand Up @@ -321,10 +322,10 @@ def is_configuration_changed(self, cached_function: Function, benchmark: Benchma

return changed

def default_function_name(self, code_package: Benchmark) -> str:
def default_function_name(self, code_package: Benchmark,resources:Resources) -> str:
return (
f"{code_package.benchmark}-{code_package.language_name}-"
f"{code_package.language_version}"
f"{code_package.language_version}-{resources.resources_id}"
)

def enforce_cold_start(self, functions: List[Function], code_package: Benchmark):
Expand Down
2 changes: 2 additions & 0 deletions tools/build_docker_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def build(image_type, system, language=None, version=None, version_name=None):
target += "." + language
if version:
target += "." + version
sebs_version = config["general"].get("SeBS_version", "unknown")
target += "." + sebs_version

# if we pass an integer, the build will fail with 'connection reset by peer'
buildargs = {
Expand Down