Skip to content

Commit

Permalink
Cleaner log messages from ecs_composex.compose.compose_services.Compo…
Browse files Browse the repository at this point in the history
…seService.ephemeral_storage() compose-x#719
  • Loading branch information
thorfi committed Nov 29, 2023
1 parent ea734af commit 132feb9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ecs_composex/compose/compose_services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,8 @@ def container_start_condition(self, value):
@property
def ephemeral_storage(self):
storage_key = "ecs.ephemeral.storage"
storage_value = set_else_none(storage_key, self.deploy_labels)
if storage_value is None:
return 0
elif isinstance(storage_value, (int, float)):
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):
ephemeral_storage = int(set_memory_to_mb(storage_value) / 1024)
Expand All @@ -518,12 +516,13 @@ def ephemeral_storage(self):
"Expected one of",
[int, float, str],
)
LOG.info(f"{self.name} - {storage_key} set to {ephemeral_storage}")
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}")
return int(ephemeral_storage)

@property
Expand Down

0 comments on commit 132feb9

Please sign in to comment.