-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from AllenInstitute/feature/MSPE-391
MSPE-391: Adding Demand Execution Constructs to CDK Lib
- Loading branch information
Showing
27 changed files
with
1,222 additions
and
1,018 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
) | ||
|
||
AIBS_INFORMATICS_AWS_LAMBDA_REPO_ENV_VAR = "AIBS_INFORMATICS_AWS_LAMBDA_REPO" | ||
AIBS_INFORMATICS_AWS_LAMBDA_REPO = "[email protected]/AllenInstitute/aibs-informatics-aws-lambda.git" | ||
AIBS_INFORMATICS_AWS_LAMBDA_REPO = "[email protected]:AllenInstitute/aibs-informatics-aws-lambda.git" | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
@@ -56,7 +56,7 @@ def resolve_repo_path(cls, repo_url: str, repo_path_env_var: Optional[str]) -> P | |
return repo_path | ||
|
||
|
||
class AIBSInformaticsCodeAssets(constructs.Construct): | ||
class AIBSInformaticsCodeAssets(constructs.Construct, AssetsMixin): | ||
def __init__( | ||
self, | ||
scope: constructs.Construct, | ||
|
@@ -76,16 +76,9 @@ def AIBS_INFORMATICS_AWS_LAMBDA(self) -> CodeAsset: | |
CodeAsset: The code asset | ||
""" | ||
|
||
if AIBS_INFORMATICS_AWS_LAMBDA_REPO_ENV_VAR in os.environ: | ||
logger.info(f"Using {AIBS_INFORMATICS_AWS_LAMBDA_REPO_ENV_VAR} from environment") | ||
repo_path = os.getenv(AIBS_INFORMATICS_AWS_LAMBDA_REPO_ENV_VAR) | ||
if not repo_path or not is_local_repo(repo_path): | ||
raise ValueError( | ||
f"Environment variable {AIBS_INFORMATICS_AWS_LAMBDA_REPO_ENV_VAR} is not a valid git repo" | ||
) | ||
repo_path = Path(repo_path) | ||
else: | ||
repo_path = clone_repo(AIBS_INFORMATICS_AWS_LAMBDA_REPO, skip_if_exists=True) | ||
repo_path = self.resolve_repo_path( | ||
AIBS_INFORMATICS_AWS_LAMBDA_REPO, AIBS_INFORMATICS_AWS_LAMBDA_REPO_ENV_VAR | ||
) | ||
|
||
asset_hash = generate_path_hash( | ||
path=str(repo_path.resolve()), | ||
|
@@ -179,8 +172,27 @@ def AIBS_INFORMATICS_AWS_LAMBDA(self) -> aws_ecr_assets.DockerImageAsset: | |
platform=aws_ecr_assets.Platform.LINUX_AMD64, | ||
asset_name="aibs-informatics-aws-lambda", | ||
file="docker/Dockerfile", | ||
extra_hash=generate_path_hash( | ||
path=str(repo_path.resolve()), | ||
excludes=PYTHON_REGEX_EXCLUDES, | ||
), | ||
exclude=[ | ||
*PYTHON_GLOB_EXCLUDES, | ||
*GLOBAL_GLOB_EXCLUDES, | ||
], | ||
) | ||
|
||
|
||
class AIBSInformaticsAssets(constructs.Construct): | ||
def __init__( | ||
self, | ||
scope: constructs.Construct, | ||
construct_id: str, | ||
env_base: EnvBase, | ||
runtime: Optional[lambda_.Runtime] = None, | ||
) -> None: | ||
super().__init__(scope, construct_id) | ||
self.env_base = env_base | ||
|
||
self.code_assets = AIBSInformaticsCodeAssets(self, "CodeAssets", env_base, runtime=runtime) | ||
self.docker_assets = AIBSInformaticsDockerAssets(self, "DockerAssets", env_base) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.