Skip to content

Commit

Permalink
Add ES as a dependency of TimeSeries
Browse files Browse the repository at this point in the history
  • Loading branch information
tcdevoe committed May 15, 2024
1 parent 3617f7e commit 109d3af
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
17 changes: 16 additions & 1 deletion service_capacity_modeling/models/org/netflix/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,22 @@ def _modify_cassandra_desires(user_desires: CapacityDesires) -> CapacityDesires:
)
return modified

return (("org.netflix.cassandra", _modify_cassandra_desires),)
def _modify_elasticsearch_desires(
user_desires: CapacityDesires,
) -> CapacityDesires:
relaxed = user_desires.copy(deep=True)
relaxed.query_pattern.access_consistency.same_region.target_consistency = (
AccessConsistency.eventual
)
return relaxed

if ts_config.search_enabled:
return (
("org.netflix.cassandra", _modify_cassandra_desires),
("org.netflix.elasticsearch", _modify_elasticsearch_desires),
)
else:
return (("org.netflix.cassandra", _modify_cassandra_desires),)

@staticmethod
def default_desires(user_desires, extra_model_arguments):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(self, extra_model_arguments: Dict[str, Any]):
self.read_amplification = self.__get_read_amplification(
self.read_interval_seconds, self.seconds_per_interval, self.buckets_per_id
)
self.search_enabled = bool(extra_model_arguments.get("search.enabled"))

# We force dependent parameters to be passed into these methods
# instead of using self to make dependencies between them more explicit
Expand Down

0 comments on commit 109d3af

Please sign in to comment.