Skip to content

Commit

Permalink
IGVF-1334-fix-conflicting-indexing-scalers (#723)
Browse files Browse the repository at this point in the history
  • Loading branch information
keenangraham authored and leepc12 committed Dec 12, 2023
1 parent ada73ec commit 2f838b3
Show file tree
Hide file tree
Showing 5 changed files with 2,985 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ repos:
- id: double-quote-string-fixer
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: ^(cdk)/tests/unit/snapshots
- id: pretty-format-json
args: ['--autofix', '--no-sort-keys', '--indent=4', '--no-ensure-ascii']
exclude: ^(cdk)/tests/unit/snapshots
- id: check-yaml
20 changes: 20 additions & 0 deletions cdk/infrastructure/constructs/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ def __init__(
self._define_opensearch()
self._define_docker_assets()
self._define_invalidation_service()
self._remove_cpu_scaling_from_invalidation_service()
self._allow_invalidation_service_to_write_to_invalidation_queue()
self._define_portal_credentials()
self._define_indexing_service()
self._remove_cpu_scaling_from_indexing_service()
self._allow_invalidation_service_to_connect_to_opensearch()
self._allow_indexing_service_to_connect_to_opensearch()
self._add_alarms_to_invalidation_service()
Expand Down Expand Up @@ -177,6 +179,15 @@ def _define_invalidation_service(self) -> None:
),
)

def _remove_cpu_scaling_from_invalidation_service(self) -> None:
self.invalidation_service.service.node.find_child(
'TaskCount'
).node.find_child(
'Target'
).node.try_remove_child(
'CpuScaling'
)

def _allow_invalidation_service_to_write_to_invalidation_queue(self) -> None:
self.props.invalidation_queue.queue.grant_send_messages(
self.invalidation_service.task_definition.task_role
Expand Down Expand Up @@ -226,6 +237,15 @@ def _define_indexing_service(self) -> None:
),
)

def _remove_cpu_scaling_from_indexing_service(self) -> None:
self.indexing_service.service.node.find_child(
'TaskCount'
).node.find_child(
'Target'
).node.try_remove_child(
'CpuScaling'
)

def _allow_invalidation_service_to_connect_to_opensearch(self) -> None:
self.invalidation_service.service.connections.allow_to(
self.opensearch.domain,
Expand Down
1 change: 1 addition & 0 deletions cdk/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pytest-instafail==0.4.2
pytest-mock==2.0.0
pytest-cov==2.8.1
mypy==0.950
pytest-snapshot==0.9.0
Loading

0 comments on commit 2f838b3

Please sign in to comment.