From d85349314c1c42a03b02bd525a0b0d746454cd74 Mon Sep 17 00:00:00 2001 From: Cibin Mathew <10793628+cibinmathew@users.noreply.github.com> Date: Thu, 13 Jul 2023 19:47:12 +0200 Subject: [PATCH 1/2] Read wlm config from local json --- src/WorkloadManagementScheduler/wlm_scheduler.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/WorkloadManagementScheduler/wlm_scheduler.py b/src/WorkloadManagementScheduler/wlm_scheduler.py index 21ea38a02..f2fe78191 100644 --- a/src/WorkloadManagementScheduler/wlm_scheduler.py +++ b/src/WorkloadManagementScheduler/wlm_scheduler.py @@ -100,6 +100,9 @@ def get_wlm_config(ruleset, region_name): elif CONFIG_KEY in ruleset and isinstance(ruleset[CONFIG_KEY], basestring): if ruleset[CONFIG_KEY].startswith('s3://'): wlm_config = json.dumps(get_file_contents(ruleset[CONFIG_KEY], region_name)) + else: # use json file in the lambda code dir + with open(ruleset[CONFIG_KEY]) as config_file: + wlm_config = config_file.read() else: raise Exception( "Malformed Configuration for Ruleset %s. '%s' must be a json based WLM configuration or an S3 file location" % ( From bf4fcca9575205a7aee80ea9bb1bdf8052562eb2 Mon Sep 17 00:00:00 2001 From: Cibin Mathew <10793628+cibinmathew@users.noreply.github.com> Date: Sat, 22 Jul 2023 15:04:56 +0200 Subject: [PATCH 2/2] feat: Read wlm config from local json file --- src/WorkloadManagementScheduler/wlm_scheduler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WorkloadManagementScheduler/wlm_scheduler.py b/src/WorkloadManagementScheduler/wlm_scheduler.py index f2fe78191..cadcd15c6 100644 --- a/src/WorkloadManagementScheduler/wlm_scheduler.py +++ b/src/WorkloadManagementScheduler/wlm_scheduler.py @@ -105,7 +105,7 @@ def get_wlm_config(ruleset, region_name): wlm_config = config_file.read() else: raise Exception( - "Malformed Configuration for Ruleset %s. '%s' must be a json based WLM configuration or an S3 file location" % ( + "Malformed Configuration for Ruleset %s. '%s' must be a json based WLM configuration or a local/S3 json file location" % ( ruleset[RULESET_NAME_KEY], CONFIG_KEY)) return wlm_config