Skip to content

Commit

Permalink
[system] Add option to use storage configuration directly for local c…
Browse files Browse the repository at this point in the history
…ontainers
  • Loading branch information
mcopik committed Jun 3, 2024
1 parent 388d15a commit 0b8d777
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions sebs.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def parse_common_params(
resource_prefix: Optional[str] = None,
initialize_deployment: bool = True,
ignore_cache: bool = False,
storage_configuration: Optional[str] = None
):

global sebs_client, deployment_client
Expand All @@ -139,6 +140,10 @@ def parse_common_params(
update_nested_dict(config_obj, ["experiments", "update_code"], update_code)
update_nested_dict(config_obj, ["experiments", "update_storage"], update_storage)

if storage_configuration:
cfg = json.load(open(storage_configuration, 'r'))
update_nested_dict(config_obj, ["deployment", deployment, "storage"], cfg)

if initialize_deployment:
deployment_client = sebs_client.get_deployment(
config_obj["deployment"], logging_filename=logging_filename
Expand Down Expand Up @@ -403,7 +408,7 @@ def local():
@click.argument("benchmark-input-size", type=click.Choice(["test", "small", "large"]))
@click.argument("output", type=str)
@click.option("--deployments", default=1, type=int, help="Number of deployed containers.")
@click.option("--deployments", default=1, type=int, help="Number of deployed containers.")
@click.option("--storage-configuration", type=str, help="JSON configuration of deployed storage.")
@click.option("--measure-interval", type=int, default=-1,
help="Interval duration between memory measurements in ms.")
@click.option(
Expand All @@ -412,14 +417,15 @@ def local():
help="Remove containers after stopping.",
)
@simplified_common_params
def start(benchmark, benchmark_input_size, output, deployments, measure_interval,
remove_containers, **kwargs):
def start(benchmark, benchmark_input_size, output, deployments, storage_configuration,
measure_interval, remove_containers, **kwargs):
"""
Start a given number of function instances and a storage instance.
"""

(config, output_dir, logging_filename, sebs_client, deployment_client) = parse_common_params(
ignore_cache=True, update_code=False, update_storage=False, deployment="local", **kwargs
ignore_cache=True, update_code=False, update_storage=False,
deployment="local", storage_configuration=storage_configuration, **kwargs
)
deployment_client = cast(sebs.local.Local, deployment_client)
deployment_client.remove_containers = remove_containers
Expand Down

0 comments on commit 0b8d777

Please sign in to comment.