diff --git a/ecs_composex/compose/compose_services/__init__.py b/ecs_composex/compose/compose_services/__init__.py index bed23662..e8cd255a 100644 --- a/ecs_composex/compose/compose_services/__init__.py +++ b/ecs_composex/compose/compose_services/__init__.py @@ -504,9 +504,7 @@ def container_start_condition(self, value): @property def ephemeral_storage(self): storage_key = "ecs.ephemeral.storage" - storage_value = set_else_none( - storage_key, set_else_none("labels", self.deploy, alt_value={}), alt_value=0 - ) + storage_value = set_else_none(storage_key, self.deploy_labels, 0) if isinstance(storage_value, (int, float)): ephemeral_storage = int(storage_value) elif isinstance(storage_value, str): @@ -520,8 +518,8 @@ def ephemeral_storage(self): ) if ephemeral_storage <= 21: return 0 - elif ephemeral_storage > 200: + LOG.warning(f"{self.name} - {storage_key} set to maximum 200 ({ephemeral_storage} > 200)") return 200 else: LOG.info(f"{self.name} - {storage_key} set to {ephemeral_storage}") diff --git a/ecs_composex/ecs/ecs_family/__init__.py b/ecs_composex/ecs/ecs_family/__init__.py index 3962103e..e1bec59a 100644 --- a/ecs_composex/ecs/ecs_family/__init__.py +++ b/ecs_composex/ecs/ecs_family/__init__.py @@ -89,7 +89,7 @@ def __init__(self, services: list[ComposeService], family_name): self.xray_service = None self.task_definition = None self.service_tags = None - self.task_ephemeral_storage = 0 + # self.task_ephemeral_storage = 0 self.enable_execute_command = False self.ecs_service = None self.runtime_cpu_arch = None @@ -201,7 +201,7 @@ def set_task_definition(self): EphemeralStorage(SizeInGiB=self.task_ephemeral_storage), NoValue, ) - if 0 < self.task_ephemeral_storage >= 21 + if self.task_ephemeral_storage >= 21 else NoValue, InferenceAccelerators=NoValue, IpcMode=If( @@ -370,7 +370,6 @@ def add_service(self, service: ComposeService): service.container_definition ) self.set_secrets_access() - self.set_task_ephemeral_storage() set_enable_execute_command(self) set_family_hostname(self) @@ -596,13 +595,13 @@ def set_services_to_services_dependencies(self): if service_depends_on not in self.services_depends_on: self.services_depends_on.append(service_depends_on) - def set_task_ephemeral_storage(self): + @property + def task_ephemeral_storage(self): """ If any service ephemeral storage is defined above, sets the ephemeral storage to the maximum of them. """ max_storage = max(service.ephemeral_storage for service in self.services) - if max_storage >= 21: - self.task_ephemeral_storage = max_storage + return max_storage if max_storage >= 21 else 0 def set_enable_execute_command(self) -> None: """