Skip to content

Commit

Permalink
Address review comments & flake8
Browse files Browse the repository at this point in the history
Signed-off-by: Mikayla Thompson <thomika@amazon.com>
  • Loading branch information
mikaylathompson committed May 16, 2024
1 parent 12e8554 commit dfea935
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ services:
- migrations
volumes:
- sharedReplayerOutput:/shared-replayer-output
- ./migrationConsole/console_link/services.yaml:/etc/migration_services.yaml
- ./migrationConsole/console_link:/root/console_link
- ./migrationConsole/lib/console_link/services.yaml:/etc/migration_services.yaml
# this is a convenience thing for testing -- it should be removed before this makes it to prod.
- ./migrationConsole/lib/console_link:/root/lib/console_link
environment:
- MIGRATION_KAFKA_BROKER_ENDPOINTS=kafka:9092
# command: ./runTestBenchmarks.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ RUN chmod ug+x /root/showFetchMigrationCommand.sh
RUN chmod ug+x /root/osiMigration.py
RUN chmod ug+x /root/kafka-tools/kafkaExport.sh

COPY console_link /root/console_link
RUN pip install -e /root/console_link/
RUN pip install -e /root/lib/console_link/

CMD tail -f /dev/null

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import console_link.logic.clusters
import console_link.logic.instantiation # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, config_file: str):
self.config = yaml.safe_load(f)
v = Validator(SCHEMA)
if not v.validate(self.config):
raise ValueError(f"Invalid config file: {v.errors}")
raise ValueError("Invalid config file", v.errors)

self.source_cluster = Cluster(self.config['source_cluster'])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, config: Dict) -> None:
self.auth_details = config["authorization"]["details"]
pass

def call_api(self, path, method: HttpMethod = HttpMethod.GET) -> Dict:
def call_api(self, path, method: HttpMethod = HttpMethod.GET) -> requests.Response:
"""
Calls an API on the cluster.
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from enum import Enum
from typing import Dict
import boto3
from cerberus import Validator

DeploymentType = Enum('DeploymentType', ['DOCKER', 'ECS'])

Expand All @@ -20,7 +21,7 @@ def __init__(self, config: Dict) -> None:
self.config = config
v = Validator(SCHEMA)
if not v.validate(config):
raise ValueError(f"Invalid config file for cluster: {v.errors}")
raise ValueError("Invalid config file for replayer", v.errors)

def start_replayer(self):
"""
Expand All @@ -43,11 +44,26 @@ def stop_replayer(self):
pass


ECS_SCHEMA = {
'cluster_name': {
'type': 'string',
'required': True
},
'service_name': {
'type': 'string',
'required': True
}
}


class ECSReplayer(BaseReplayer):
client = boto3.client('ecs')

def __init__(self, config: Dict) -> None:
super().__init__(config)
v = Validator(ECS_SCHEMA)
if not v.validate(config):
raise ValueError("Invalid config file for replayer", v.errors)
self.cluster_name = config['cluster_name']
self.service_name = config['service_name']

Expand Down

0 comments on commit dfea935

Please sign in to comment.