From 0bcc72831513ff2c9de09d651ad43d82d6c184ae Mon Sep 17 00:00:00 2001 From: Alejandro Esquivel Date: Wed, 5 Oct 2022 05:30:05 -0700 Subject: [PATCH] Falling back to config file defaults in using executor class (#43) * Falling back to config file defaults in using executor class Falling back to config file defaults when using executor via instantiation of executor class * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Venkat Bala <15014089+venkatBala@users.noreply.github.com> --- CHANGELOG.md | 6 ++++++ covalent_awslambda_plugin/awslambda.py | 17 +++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53119b5..4ea3992 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [UNRELEASED] + +### Fixed + +- Falling back to config file defaults when using executor via instantiation of executor class + ### Docs - Updated docs to include more information about required/optional config values, and provide information about each cloud resource that needs to be provisioned. + ## [0.11.0] - 2022-10-03 diff --git a/covalent_awslambda_plugin/awslambda.py b/covalent_awslambda_plugin/awslambda.py index 615b1f7..9adcab7 100644 --- a/covalent_awslambda_plugin/awslambda.py +++ b/covalent_awslambda_plugin/awslambda.py @@ -151,11 +151,11 @@ class AWSLambdaExecutor(AWSExecutor): def __init__( self, - credentials_file: str, - profile: str, - region: str, s3_bucket_name: str, execution_role: str, + credentials_file: str = None, + profile: str = None, + region: str = None, poll_freq: int = None, timeout: int = None, memory_size: int = None, @@ -164,11 +164,12 @@ def __init__( # AWSExecutor parameters required_attrs = { - "credentials_file": credentials_file, - "profile": profile, - "region": region, - "s3_bucket_name": s3_bucket_name, - "execution_role": execution_role, + "credentials_file": credentials_file + or get_config("executors.awslambda.credentials_file"), + "profile": profile or get_config("executors.awslambda.profile"), + "region": region or get_config("executors.awslambda.region"), + "s3_bucket_name": s3_bucket_name or get_config("executors.awslambda.s3_bucket_name"), + "execution_role": execution_role or get_config("executors.awslambda.execution_role"), } super().__init__(**required_attrs)