Skip to content

Commit

Permalink
addressing PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rpmcginty committed Jun 5, 2024
1 parent 20bc4b8 commit 1decff6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 42 deletions.
6 changes: 3 additions & 3 deletions src/aibs_informatics_cdk_lib/constructs_/cw/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ def create_widgets_and_alarms(
metric_name = graph_metric.label or metric_config["statistic"]
else:
metric = metric_config["metric"]
if isinstance(metric, cw.IMetric):
metric_name = cast(str, metric.metric_name)
if isinstance(metric, cw.Metric):
metric_name = metric.metric_name
else:
metric_name = metric
metric_name = str(metric)
metric_label = metric_config.get(
"label",
re.sub(
Expand Down
3 changes: 2 additions & 1 deletion src/aibs_informatics_cdk_lib/constructs_/efs/file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def access_point_id(self) -> Optional[str]:
def to_batch_mount_point(self, name: str, sfn_format: bool = False) -> dict[str, Any]:
mount_point: dict[str, Any] = to_mount_point(
self.mount_point, self.read_only, source_volume=name
) # type: ignore
) # type: ignore[arg-type] # typed dict should be accepted
if sfn_format:
return convert_to_sfn_api_action_case(mount_point)
return mount_point
Expand All @@ -267,6 +267,7 @@ def to_batch_volume(self, name: str, sfn_format: bool = False) -> dict[str, Any]
}
if self.access_point:
efs_volume_configuration["transitEncryption"] = "ENABLED"
# TODO: Consider adding IAM
efs_volume_configuration["authorizationConfig"] = {
"accessPointId": self.access_point.access_point_id,
"iam": "DISABLED",
Expand Down
Empty file.
26 changes: 9 additions & 17 deletions src/aibs_informatics_core_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
from aibs_informatics_cdk_lib.project.utils import get_config
from aibs_informatics_cdk_lib.stages.base import ConfigBasedStage
from aibs_informatics_core_app.stacks.assets import AIBSInformaticsAssetsStack
from aibs_informatics_core_app.stacks.core import CoreStack
from aibs_informatics_core_app.stacks.demand_execution import (
DemandExecutionInfrastructureStack,
DemandExecutionStack,
)
from aibs_informatics_core_app.stacks.network import NetworkStack
from aibs_informatics_core_app.stacks.storage import StorageStack


class InfraStage(ConfigBasedStage):
Expand All @@ -25,29 +24,22 @@ def __init__(self, scope: Construct, config: StageConfig, **kwargs) -> None:
self.env_base,
env=self.env,
)
network = NetworkStack(
core = CoreStack(
self,
self.get_stack_name("Network"),
self.get_stack_name("Core"),
self.env_base,
env=self.env,
)
storage = StorageStack(
self,
self.get_stack_name("Storage"),
self.env_base,
"core",
vpc=network.vpc,
name="core",
env=self.env,
)

demand_execution_infra = DemandExecutionInfrastructureStack(
self,
self.get_stack_name("DemandExecutionInfra"),
self.env_base,
vpc=network.vpc,
buckets=[storage.bucket],
vpc=core.vpc,
buckets=[core.bucket],
mount_point_configs=[
MountPointConfiguration.from_file_system(storage.file_system, None, "/opt/efs"),
MountPointConfiguration.from_file_system(core.file_system, None, "/opt/efs"),
],
env=self.env,
)
Expand All @@ -57,8 +49,8 @@ def __init__(self, scope: Construct, config: StageConfig, **kwargs) -> None:
self.get_stack_name("DemandExecution"),
env_base=self.env_base,
assets=assets.assets,
scaffolding_bucket=storage.bucket,
efs_ecosystem=storage.efs_ecosystem,
scaffolding_bucket=core.bucket,
efs_ecosystem=core.efs_ecosystem,
data_sync_job_queue=demand_execution_infra.infra_compute.lambda_medium_batch_environment.job_queue_name,
scaffolding_job_queue=demand_execution_infra.infra_compute.primary_batch_environment.job_queue_name,
execution_job_queue=demand_execution_infra.execution_compute.primary_batch_environment.job_queue_name,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
from typing import Optional

from aibs_informatics_core.env import EnvBase
from aws_cdk import aws_ec2 as ec2
from constructs import Construct

from aibs_informatics_cdk_lib.constructs_.ec2.network import EnvBaseVpc
from aibs_informatics_cdk_lib.constructs_.efs.file_system import EFSEcosystem, EnvBaseFileSystem
from aibs_informatics_cdk_lib.constructs_.s3 import EnvBaseBucket, LifecycleRuleGenerator
from aibs_informatics_cdk_lib.stacks.base import EnvBaseStack


class StorageStack(EnvBaseStack):
class CoreStack(EnvBaseStack):
def __init__(
self,
scope: Construct,
id: Optional[str],
env_base: EnvBase,
name: str,
vpc: ec2.Vpc,
**kwargs,
) -> None:
super().__init__(scope, id, env_base, **kwargs)
self._vpc = EnvBaseVpc(self, "Vpc", self.env_base, max_azs=4)

self._bucket = EnvBaseBucket(
self,
Expand All @@ -35,10 +35,14 @@ def __init__(
)

self._efs_ecosystem = EFSEcosystem(
self, id="EFS", env_base=self.env_base, file_system_name=name, vpc=vpc
self, id="EFS", env_base=self.env_base, file_system_name=name, vpc=self.vpc
)
self._file_system = self._efs_ecosystem.file_system

@property
def vpc(self) -> EnvBaseVpc:
return self._vpc

@property
def bucket(self) -> EnvBaseBucket:
return self._bucket
Expand Down
17 changes: 0 additions & 17 deletions src/aibs_informatics_core_app/stacks/network.py

This file was deleted.

0 comments on commit 1decff6

Please sign in to comment.