Skip to content

Commit

Permalink
update the entity model to provision crdb+kv
Browse files Browse the repository at this point in the history
  • Loading branch information
abersnaze committed Oct 19, 2023
1 parent f0dde0d commit 9b183e3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions service_capacity_modeling/models/org/netflix/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Callable
from typing import Dict
from typing import Optional
from typing import Sequence
from typing import Tuple

from .stateless_java import nflx_java_app_capacity_model
Expand Down Expand Up @@ -60,6 +59,16 @@ def extra_model_arguments_schema() -> Dict[str, Any]:
def compose_with(
user_desires: CapacityDesires, extra_model_arguments: Dict[str, Any]
) -> Tuple[Tuple[str, Callable[[CapacityDesires], CapacityDesires]], ...]:
def _modify_crdb_desires(
user_desires: CapacityDesires,
) -> CapacityDesires:
relaxed = user_desires.copy(deep=True)
item_count = relaxed.data_shape.estimated_state_item_count
if item_count is None:
item_count = relaxed.data_shape.estimated_state_size_gib.scale(1000)
relaxed.data_shape.estimated_state_size_gib = item_count.scale(256)
return relaxed

def _modify_elasticsearch_desires(
user_desires: CapacityDesires,
) -> CapacityDesires:
Expand All @@ -70,7 +79,8 @@ def _modify_elasticsearch_desires(
return relaxed

return (
("org.netflix.cassandra", lambda x: x),
("org.netflix.cockroachdb", _modify_crdb_desires),
("org.netflix.key-value", lambda x: x),
("org.netflix.elasticsearch", _modify_elasticsearch_desires),
)

Expand Down

0 comments on commit 9b183e3

Please sign in to comment.