Skip to content

Commit

Permalink
Merge pull request #79 from nickmahilani/extra-kafka-model-args
Browse files Browse the repository at this point in the history
fix pre-commit check failures
  • Loading branch information
abersnaze authored Oct 25, 2023
2 parents fe726e7 + 1f83daf commit a7caf1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
14 changes: 5 additions & 9 deletions service_capacity_modeling/models/org/netflix/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ def _kafka_read_io(rps, io_size_kib, size_gib, recovery_seconds: int) -> float:
return (read_ios + int(round(recovery_ios))) * 1.5


# pylint: disable=too-many-locals
# pylint: disable=too-many-return-statements
def _estimate_kafka_cluster_zonal(
instance: Instance,
drive: Drive,
Expand All @@ -165,12 +167,8 @@ def _estimate_kafka_cluster_zonal(
min_instance_memory_gib: int = 12,
) -> Optional[CapacityPlan]:

# Kafka doesn't like to deploy on single CPU instances
if instance.cpu < min_instance_cpu:
return None

# Kafka doesn't like to deploy to instances with < 7 GiB of ram
if instance.ram_gib < min_instance_memory_gib:
# Kafka doesn't like to deploy on single CPU instances or with < 12 GiB of ram
if instance.cpu < min_instance_cpu or instance.ram_gib < min_instance_memory_gib:
return None

# if we're not allowed to use attached disks, skip EBS only types
Expand Down Expand Up @@ -377,9 +375,7 @@ def capacity_plan(
max_local_disk_gib: int = extra_model_arguments.get(
"max_local_disk_gib", 1024 * 5
)
min_instance_cpu: int = extra_model_arguments.get(
"min_instance_cpu", 2
)
min_instance_cpu: int = extra_model_arguments.get("min_instance_cpu", 2)
min_instance_memory_gib: int = extra_model_arguments.get(
"min_instance_memory_gib", 12
)
Expand Down
5 changes: 3 additions & 2 deletions tests/netflix/test_kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def test_kafka_high_throughput_ebs():
disk = clstr.attached_drives[0].size_gib * clstr.count
assert expected_disk[0] < disk < expected_disk[1] * 2.5


def test_kafka_model_constraints():
# 2.8 GiB / second
throughput = 2.8 * 1024 * 1024 * 1024
Expand Down Expand Up @@ -239,7 +240,7 @@ def test_kafka_model_constraints():
"retention": "PT3H",
"require_attached_disks": require_attached_disks,
"min_instance_cpu": min_instance_cpu,
"required_zone_size": required_zone_size
"required_zone_size": required_zone_size,
},
num_results=3,
)
Expand All @@ -261,7 +262,7 @@ def test_kafka_model_constraints():
"retention": "PT3H",
"require_local_disks": True,
"min_instance_cpu": min_instance_cpu,
"required_zone_size": required_zone_size
"required_zone_size": required_zone_size,
},
num_results=3,
)
Expand Down

0 comments on commit a7caf1d

Please sign in to comment.