From b46543cd91337d6a46dda1beac01bb3bb71eb3c4 Mon Sep 17 00:00:00 2001 From: Donald Campbell <125581724+donaldcampbelljr@users.noreply.github.com> Date: Mon, 24 Jun 2024 14:36:06 -0400 Subject: [PATCH 1/9] cli_modifiers key reverted to `cli` --- looper/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/looper/const.py b/looper/const.py index e38cee18..0243dc88 100644 --- a/looper/const.py +++ b/looper/const.py @@ -224,7 +224,7 @@ def _get_apperance_dict(type, templ=APPEARANCE_BY_FLAG): SAMPLE_PL_ARG = "sample_pipeline_interfaces" PROJECT_PL_ARG = "project_pipeline_interfaces" -CLI_MODS_KEY = "cli_modifiers" +CLI_MODS_KEY = "cli" DEFAULT_CFG_PATH = os.path.join(os.getcwd(), LOOPER_DOTFILE_NAME) From 3175f27f18b595b8b1634261990c5c63551d39d5 Mon Sep 17 00:00:00 2001 From: Donald Campbell <125581724+donaldcampbelljr@users.noreply.github.com> Date: Mon, 24 Jun 2024 15:16:24 -0400 Subject: [PATCH 2/9] fix bug with None type for non-existing project arguments --- looper/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/looper/utils.py b/looper/utils.py index 26776db7..eaeb0e2e 100644 --- a/looper/utils.py +++ b/looper/utils.py @@ -283,6 +283,8 @@ def enrich_args_via_cfg( if getattr(parser_args, key, None): new_value = getattr(parser_args, key) cfg_args_all[key] = new_value + else: + cfg_args_all = {} looper_config_cli_modifiers = None if cli_modifiers: From 2d6230ac71af4bdbc37fa0ccec75e16d4a39c99e Mon Sep 17 00:00:00 2001 From: Donald Campbell <125581724+donaldcampbelljr@users.noreply.github.com> Date: Mon, 24 Jun 2024 15:19:19 -0400 Subject: [PATCH 3/9] Refactor CLI_MODS_KEY to CLI_KEY --- looper/cli_pydantic.py | 2 +- looper/const.py | 2 -- looper/utils.py | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/looper/cli_pydantic.py b/looper/cli_pydantic.py index 9e5aca16..1da526e5 100644 --- a/looper/cli_pydantic.py +++ b/looper/cli_pydantic.py @@ -154,7 +154,7 @@ def run_looper(args: TopLevelParser, parser: ArgumentParser, test_args=None): for looper_config_key, looper_config_item in looper_config_dict.items(): if looper_config_key == SAMPLE_MODS_KEY: sample_modifiers_dict = looper_config_item - elif looper_config_key == CLI_MODS_KEY: + elif looper_config_key == CLI_KEY: cli_modifiers_dict = looper_config_item else: setattr(subcommand_args, looper_config_key, looper_config_item) diff --git a/looper/const.py b/looper/const.py index 0243dc88..bf40954d 100644 --- a/looper/const.py +++ b/looper/const.py @@ -93,7 +93,6 @@ "DEBUG_EIDO_VALIDATION", "LOOPER_GENERIC_OUTPUT_SCHEMA", "LOOPER_GENERIC_COUNT_LINES", - "CLI_MODS_KEY", "PipelineLevel", ] @@ -224,7 +223,6 @@ def _get_apperance_dict(type, templ=APPEARANCE_BY_FLAG): SAMPLE_PL_ARG = "sample_pipeline_interfaces" PROJECT_PL_ARG = "project_pipeline_interfaces" -CLI_MODS_KEY = "cli" DEFAULT_CFG_PATH = os.path.join(os.getcwd(), LOOPER_DOTFILE_NAME) diff --git a/looper/utils.py b/looper/utils.py index eaeb0e2e..4eb8ca4b 100644 --- a/looper/utils.py +++ b/looper/utils.py @@ -606,8 +606,8 @@ def read_looper_config_file(looper_config_path: str) -> dict: if SAMPLE_MODS_KEY in dp_data: return_dict[SAMPLE_MODS_KEY] = dp_data[SAMPLE_MODS_KEY] - if CLI_MODS_KEY in dp_data: - return_dict[CLI_MODS_KEY] = dp_data[CLI_MODS_KEY] + if CLI_KEY in dp_data: + return_dict[CLI_KEY] = dp_data[CLI_KEY] if PIPELINE_INTERFACES_KEY in dp_data: From 9d253e42de48e56496969952e1275a18aa633ac4 Mon Sep 17 00:00:00 2001 From: Donald Campbell <125581724+donaldcampbelljr@users.noreply.github.com> Date: Mon, 24 Jun 2024 16:35:07 -0400 Subject: [PATCH 4/9] attempt to create modified PEP via dictionary --- looper/cli_pydantic.py | 10 ++++----- looper/const.py | 3 ++- looper/project.py | 48 +++++++++++++++++++++++++++++++----------- looper/utils.py | 4 ++-- 4 files changed, 45 insertions(+), 20 deletions(-) diff --git a/looper/cli_pydantic.py b/looper/cli_pydantic.py index 1da526e5..e979b6eb 100644 --- a/looper/cli_pydantic.py +++ b/looper/cli_pydantic.py @@ -149,11 +149,11 @@ def run_looper(args: TopLevelParser, parser: ArgumentParser, test_args=None): looper_config_dict = read_looper_dotfile() _LOGGER.info(f"Using looper config ({looper_cfg_path}).") - sample_modifiers_dict = None + pep_update_dict = None cli_modifiers_dict = None for looper_config_key, looper_config_item in looper_config_dict.items(): - if looper_config_key == SAMPLE_MODS_KEY: - sample_modifiers_dict = looper_config_item + if looper_config_key == PEP_UPDATE_KEY: + pep_update_dict = looper_config_item elif looper_config_key == CLI_KEY: cli_modifiers_dict = looper_config_item else: @@ -203,7 +203,7 @@ def run_looper(args: TopLevelParser, parser: ArgumentParser, test_args=None): amendments=subcommand_args.amend, divcfg_path=divcfg, runp=subcommand_name == "runp", - sample_modifiers=sample_modifiers_dict, + pep_update=pep_update_dict, **{ attr: getattr(subcommand_args, attr) for attr in CLI_PROJ_ATTRS @@ -219,7 +219,7 @@ def run_looper(args: TopLevelParser, parser: ArgumentParser, test_args=None): amendments=subcommand_args.amend, divcfg_path=divcfg, runp=subcommand_name == "runp", - sample_modifiers=sample_modifiers_dict, + pep_update=pep_update_dict, project_dict=PEPHubClient()._load_raw_pep( registry_path=subcommand_args.config_file ), diff --git a/looper/const.py b/looper/const.py index bf40954d..9e39f506 100644 --- a/looper/const.py +++ b/looper/const.py @@ -94,6 +94,7 @@ "LOOPER_GENERIC_OUTPUT_SCHEMA", "LOOPER_GENERIC_COUNT_LINES", "PipelineLevel", + "PEP_UPDATE_KEY", ] FLAGS = ["completed", "running", "failed", "waiting", "partial"] @@ -222,7 +223,7 @@ def _get_apperance_dict(type, templ=APPEARANCE_BY_FLAG): ALL_SUBCMD_KEY = "all" SAMPLE_PL_ARG = "sample_pipeline_interfaces" PROJECT_PL_ARG = "project_pipeline_interfaces" - +PEP_UPDATE_KEY = "pep_update" DEFAULT_CFG_PATH = os.path.join(os.getcwd(), LOOPER_DOTFILE_NAME) diff --git a/looper/project.py b/looper/project.py index 6daecac1..2e7f4c65 100644 --- a/looper/project.py +++ b/looper/project.py @@ -111,7 +111,31 @@ class Project(peppyProject): """ def __init__(self, cfg=None, amendments=None, divcfg_path=None, **kwargs): - super(Project, self).__init__(cfg=cfg, amendments=amendments) + + if kwargs.get("pep_update"): + + _LOGGER.warning( + "Pep update key supplied in looper config. Merging with PEP Project" + ) + + pep_update_dict = kwargs.get("pep_update") + temp_pep = peppyProject(cfg=cfg, amendments=amendments) + dict_obj_pep = temp_pep.to_dict(extended=True) # to make this a real PEP + + if SAMPLE_MODS_KEY in pep_update_dict: + dict_obj_pep.setdefault(SAMPLE_MODS_KEY, {}) + deep_update( + dict_obj_pep[SAMPLE_MODS_KEY], pep_update_dict[SAMPLE_MODS_KEY] + ) + if PROJ_MODS_KEY in pep_update_dict: + dict_obj_pep.setdefault(PROJ_MODS_KEY, {}) + deep_update(dict_obj_pep[PROJ_MODS_KEY], pep_update_dict[PROJ_MODS_KEY]) + + super(Project, self).from_dict(pep_dictionary=dict_obj_pep) + + else: + super(Project, self).__init__(cfg=cfg, amendments=amendments) + prj_dict = kwargs.get("project_dict") pep_config = kwargs.get("pep_config", None) if pep_config: @@ -132,17 +156,17 @@ def __init__(self, cfg=None, amendments=None, divcfg_path=None, **kwargs): self.name = None # consolidate sample modifiers - if kwargs.get(SAMPLE_MODS_KEY) and self._modifier_exists(): - _LOGGER.warning( - "Sample modifiers were provided in Looper Config and in PEP Project Config. Merging..." - ) - deep_update(self.config["sample_modifiers"], kwargs.get(SAMPLE_MODS_KEY)) - _LOGGER.debug( - msg=f"Merged sample modifiers: {self.config['sample_modifiers']}" - ) - elif kwargs.get(SAMPLE_MODS_KEY): - self.config.setdefault("sample_modifiers", {}) - self.config["sample_modifiers"] = kwargs.get(SAMPLE_MODS_KEY) + # if kwargs.get(SAMPLE_MODS_KEY) and self._modifier_exists(): + # _LOGGER.warning( + # "Sample modifiers were provided in Looper Config and in PEP Project Config. Merging..." + # ) + # deep_update(self.config["sample_modifiers"], kwargs.get(SAMPLE_MODS_KEY)) + # _LOGGER.debug( + # msg=f"Merged sample modifiers: {self.config['sample_modifiers']}" + # ) + # elif kwargs.get(SAMPLE_MODS_KEY): + # self.config.setdefault("sample_modifiers", {}) + # self.config["sample_modifiers"] = kwargs.get(SAMPLE_MODS_KEY) # add sample pipeline interface to the project if kwargs.get(SAMPLE_PL_ARG): diff --git a/looper/utils.py b/looper/utils.py index 4eb8ca4b..af1d80c9 100644 --- a/looper/utils.py +++ b/looper/utils.py @@ -603,8 +603,8 @@ def read_looper_config_file(looper_config_path: str) -> dict: if PIPESTAT_KEY in dp_data: return_dict[PIPESTAT_KEY] = dp_data[PIPESTAT_KEY] - if SAMPLE_MODS_KEY in dp_data: - return_dict[SAMPLE_MODS_KEY] = dp_data[SAMPLE_MODS_KEY] + if PEP_UPDATE_KEY in dp_data: + return_dict[PEP_UPDATE_KEY] = dp_data[PEP_UPDATE_KEY] if CLI_KEY in dp_data: return_dict[CLI_KEY] = dp_data[CLI_KEY] From c8e86abdcdf053b514fc46aa9315d25052f0f771 Mon Sep 17 00:00:00 2001 From: Donald Campbell <125581724+donaldcampbelljr@users.noreply.github.com> Date: Tue, 25 Jun 2024 11:03:48 -0400 Subject: [PATCH 5/9] fix modifying PEP via _from_dict() --- looper/project.py | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/looper/project.py b/looper/project.py index 2e7f4c65..138873c5 100644 --- a/looper/project.py +++ b/looper/project.py @@ -112,10 +112,12 @@ class Project(peppyProject): def __init__(self, cfg=None, amendments=None, divcfg_path=None, **kwargs): + super(Project, self).__init__(cfg=cfg, amendments=amendments) + if kwargs.get("pep_update"): _LOGGER.warning( - "Pep update key supplied in looper config. Merging with PEP Project" + "PEP update key supplied in looper config. Merging with PEP Project" ) pep_update_dict = kwargs.get("pep_update") @@ -131,10 +133,7 @@ def __init__(self, cfg=None, amendments=None, divcfg_path=None, **kwargs): dict_obj_pep.setdefault(PROJ_MODS_KEY, {}) deep_update(dict_obj_pep[PROJ_MODS_KEY], pep_update_dict[PROJ_MODS_KEY]) - super(Project, self).from_dict(pep_dictionary=dict_obj_pep) - - else: - super(Project, self).__init__(cfg=cfg, amendments=amendments) + self._from_dict(pep_dictionary=dict_obj_pep) prj_dict = kwargs.get("project_dict") pep_config = kwargs.get("pep_config", None) @@ -155,19 +154,6 @@ def __init__(self, cfg=None, amendments=None, divcfg_path=None, **kwargs): except NotImplementedError: self.name = None - # consolidate sample modifiers - # if kwargs.get(SAMPLE_MODS_KEY) and self._modifier_exists(): - # _LOGGER.warning( - # "Sample modifiers were provided in Looper Config and in PEP Project Config. Merging..." - # ) - # deep_update(self.config["sample_modifiers"], kwargs.get(SAMPLE_MODS_KEY)) - # _LOGGER.debug( - # msg=f"Merged sample modifiers: {self.config['sample_modifiers']}" - # ) - # elif kwargs.get(SAMPLE_MODS_KEY): - # self.config.setdefault("sample_modifiers", {}) - # self.config["sample_modifiers"] = kwargs.get(SAMPLE_MODS_KEY) - # add sample pipeline interface to the project if kwargs.get(SAMPLE_PL_ARG): self.set_sample_piface(kwargs.get(SAMPLE_PL_ARG)) From 5edaf40478793da95e7179faf7fcde660554a421 Mon Sep 17 00:00:00 2001 From: Donald Campbell <125581724+donaldcampbelljr@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:45:47 -0400 Subject: [PATCH 6/9] Revert "fix modifying PEP via _from_dict()" This reverts commit c8e86abdcdf053b514fc46aa9315d25052f0f771. --- looper/project.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/looper/project.py b/looper/project.py index 138873c5..2e7f4c65 100644 --- a/looper/project.py +++ b/looper/project.py @@ -112,12 +112,10 @@ class Project(peppyProject): def __init__(self, cfg=None, amendments=None, divcfg_path=None, **kwargs): - super(Project, self).__init__(cfg=cfg, amendments=amendments) - if kwargs.get("pep_update"): _LOGGER.warning( - "PEP update key supplied in looper config. Merging with PEP Project" + "Pep update key supplied in looper config. Merging with PEP Project" ) pep_update_dict = kwargs.get("pep_update") @@ -133,7 +131,10 @@ def __init__(self, cfg=None, amendments=None, divcfg_path=None, **kwargs): dict_obj_pep.setdefault(PROJ_MODS_KEY, {}) deep_update(dict_obj_pep[PROJ_MODS_KEY], pep_update_dict[PROJ_MODS_KEY]) - self._from_dict(pep_dictionary=dict_obj_pep) + super(Project, self).from_dict(pep_dictionary=dict_obj_pep) + + else: + super(Project, self).__init__(cfg=cfg, amendments=amendments) prj_dict = kwargs.get("project_dict") pep_config = kwargs.get("pep_config", None) @@ -154,6 +155,19 @@ def __init__(self, cfg=None, amendments=None, divcfg_path=None, **kwargs): except NotImplementedError: self.name = None + # consolidate sample modifiers + # if kwargs.get(SAMPLE_MODS_KEY) and self._modifier_exists(): + # _LOGGER.warning( + # "Sample modifiers were provided in Looper Config and in PEP Project Config. Merging..." + # ) + # deep_update(self.config["sample_modifiers"], kwargs.get(SAMPLE_MODS_KEY)) + # _LOGGER.debug( + # msg=f"Merged sample modifiers: {self.config['sample_modifiers']}" + # ) + # elif kwargs.get(SAMPLE_MODS_KEY): + # self.config.setdefault("sample_modifiers", {}) + # self.config["sample_modifiers"] = kwargs.get(SAMPLE_MODS_KEY) + # add sample pipeline interface to the project if kwargs.get(SAMPLE_PL_ARG): self.set_sample_piface(kwargs.get(SAMPLE_PL_ARG)) From 68a58e0c18593746e0d1eae5ea44de055298e787 Mon Sep 17 00:00:00 2001 From: Donald Campbell <125581724+donaldcampbelljr@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:45:47 -0400 Subject: [PATCH 7/9] Revert "attempt to create modified PEP via dictionary" This reverts commit 9d253e42de48e56496969952e1275a18aa633ac4. --- looper/cli_pydantic.py | 10 ++++----- looper/const.py | 3 +-- looper/project.py | 48 +++++++++++------------------------------- looper/utils.py | 4 ++-- 4 files changed, 20 insertions(+), 45 deletions(-) diff --git a/looper/cli_pydantic.py b/looper/cli_pydantic.py index e979b6eb..1da526e5 100644 --- a/looper/cli_pydantic.py +++ b/looper/cli_pydantic.py @@ -149,11 +149,11 @@ def run_looper(args: TopLevelParser, parser: ArgumentParser, test_args=None): looper_config_dict = read_looper_dotfile() _LOGGER.info(f"Using looper config ({looper_cfg_path}).") - pep_update_dict = None + sample_modifiers_dict = None cli_modifiers_dict = None for looper_config_key, looper_config_item in looper_config_dict.items(): - if looper_config_key == PEP_UPDATE_KEY: - pep_update_dict = looper_config_item + if looper_config_key == SAMPLE_MODS_KEY: + sample_modifiers_dict = looper_config_item elif looper_config_key == CLI_KEY: cli_modifiers_dict = looper_config_item else: @@ -203,7 +203,7 @@ def run_looper(args: TopLevelParser, parser: ArgumentParser, test_args=None): amendments=subcommand_args.amend, divcfg_path=divcfg, runp=subcommand_name == "runp", - pep_update=pep_update_dict, + sample_modifiers=sample_modifiers_dict, **{ attr: getattr(subcommand_args, attr) for attr in CLI_PROJ_ATTRS @@ -219,7 +219,7 @@ def run_looper(args: TopLevelParser, parser: ArgumentParser, test_args=None): amendments=subcommand_args.amend, divcfg_path=divcfg, runp=subcommand_name == "runp", - pep_update=pep_update_dict, + sample_modifiers=sample_modifiers_dict, project_dict=PEPHubClient()._load_raw_pep( registry_path=subcommand_args.config_file ), diff --git a/looper/const.py b/looper/const.py index 9e39f506..bf40954d 100644 --- a/looper/const.py +++ b/looper/const.py @@ -94,7 +94,6 @@ "LOOPER_GENERIC_OUTPUT_SCHEMA", "LOOPER_GENERIC_COUNT_LINES", "PipelineLevel", - "PEP_UPDATE_KEY", ] FLAGS = ["completed", "running", "failed", "waiting", "partial"] @@ -223,7 +222,7 @@ def _get_apperance_dict(type, templ=APPEARANCE_BY_FLAG): ALL_SUBCMD_KEY = "all" SAMPLE_PL_ARG = "sample_pipeline_interfaces" PROJECT_PL_ARG = "project_pipeline_interfaces" -PEP_UPDATE_KEY = "pep_update" + DEFAULT_CFG_PATH = os.path.join(os.getcwd(), LOOPER_DOTFILE_NAME) diff --git a/looper/project.py b/looper/project.py index 2e7f4c65..6daecac1 100644 --- a/looper/project.py +++ b/looper/project.py @@ -111,31 +111,7 @@ class Project(peppyProject): """ def __init__(self, cfg=None, amendments=None, divcfg_path=None, **kwargs): - - if kwargs.get("pep_update"): - - _LOGGER.warning( - "Pep update key supplied in looper config. Merging with PEP Project" - ) - - pep_update_dict = kwargs.get("pep_update") - temp_pep = peppyProject(cfg=cfg, amendments=amendments) - dict_obj_pep = temp_pep.to_dict(extended=True) # to make this a real PEP - - if SAMPLE_MODS_KEY in pep_update_dict: - dict_obj_pep.setdefault(SAMPLE_MODS_KEY, {}) - deep_update( - dict_obj_pep[SAMPLE_MODS_KEY], pep_update_dict[SAMPLE_MODS_KEY] - ) - if PROJ_MODS_KEY in pep_update_dict: - dict_obj_pep.setdefault(PROJ_MODS_KEY, {}) - deep_update(dict_obj_pep[PROJ_MODS_KEY], pep_update_dict[PROJ_MODS_KEY]) - - super(Project, self).from_dict(pep_dictionary=dict_obj_pep) - - else: - super(Project, self).__init__(cfg=cfg, amendments=amendments) - + super(Project, self).__init__(cfg=cfg, amendments=amendments) prj_dict = kwargs.get("project_dict") pep_config = kwargs.get("pep_config", None) if pep_config: @@ -156,17 +132,17 @@ def __init__(self, cfg=None, amendments=None, divcfg_path=None, **kwargs): self.name = None # consolidate sample modifiers - # if kwargs.get(SAMPLE_MODS_KEY) and self._modifier_exists(): - # _LOGGER.warning( - # "Sample modifiers were provided in Looper Config and in PEP Project Config. Merging..." - # ) - # deep_update(self.config["sample_modifiers"], kwargs.get(SAMPLE_MODS_KEY)) - # _LOGGER.debug( - # msg=f"Merged sample modifiers: {self.config['sample_modifiers']}" - # ) - # elif kwargs.get(SAMPLE_MODS_KEY): - # self.config.setdefault("sample_modifiers", {}) - # self.config["sample_modifiers"] = kwargs.get(SAMPLE_MODS_KEY) + if kwargs.get(SAMPLE_MODS_KEY) and self._modifier_exists(): + _LOGGER.warning( + "Sample modifiers were provided in Looper Config and in PEP Project Config. Merging..." + ) + deep_update(self.config["sample_modifiers"], kwargs.get(SAMPLE_MODS_KEY)) + _LOGGER.debug( + msg=f"Merged sample modifiers: {self.config['sample_modifiers']}" + ) + elif kwargs.get(SAMPLE_MODS_KEY): + self.config.setdefault("sample_modifiers", {}) + self.config["sample_modifiers"] = kwargs.get(SAMPLE_MODS_KEY) # add sample pipeline interface to the project if kwargs.get(SAMPLE_PL_ARG): diff --git a/looper/utils.py b/looper/utils.py index af1d80c9..4eb8ca4b 100644 --- a/looper/utils.py +++ b/looper/utils.py @@ -603,8 +603,8 @@ def read_looper_config_file(looper_config_path: str) -> dict: if PIPESTAT_KEY in dp_data: return_dict[PIPESTAT_KEY] = dp_data[PIPESTAT_KEY] - if PEP_UPDATE_KEY in dp_data: - return_dict[PEP_UPDATE_KEY] = dp_data[PEP_UPDATE_KEY] + if SAMPLE_MODS_KEY in dp_data: + return_dict[SAMPLE_MODS_KEY] = dp_data[SAMPLE_MODS_KEY] if CLI_KEY in dp_data: return_dict[CLI_KEY] = dp_data[CLI_KEY] From cddb3be26218fd70aa6432b3b85ad90fb3ff85ae Mon Sep 17 00:00:00 2001 From: Donald Campbell <125581724+donaldcampbelljr@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:49:39 -0400 Subject: [PATCH 8/9] lint --- looper/const.py | 1 - 1 file changed, 1 deletion(-) diff --git a/looper/const.py b/looper/const.py index bf40954d..de080260 100644 --- a/looper/const.py +++ b/looper/const.py @@ -224,7 +224,6 @@ def _get_apperance_dict(type, templ=APPEARANCE_BY_FLAG): PROJECT_PL_ARG = "project_pipeline_interfaces" - DEFAULT_CFG_PATH = os.path.join(os.getcwd(), LOOPER_DOTFILE_NAME) CLI_PROJ_ATTRS = [ OUTDIR_KEY, From 34f3db7c918d7aa9af2f036dcfe813c064731561 Mon Sep 17 00:00:00 2001 From: Donald Campbell <125581724+donaldcampbelljr@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:54:11 -0400 Subject: [PATCH 9/9] remove modifying sample_modifiers --- looper/cli_pydantic.py | 7 +------ looper/project.py | 13 ------------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/looper/cli_pydantic.py b/looper/cli_pydantic.py index 1da526e5..16bb6206 100644 --- a/looper/cli_pydantic.py +++ b/looper/cli_pydantic.py @@ -149,12 +149,9 @@ def run_looper(args: TopLevelParser, parser: ArgumentParser, test_args=None): looper_config_dict = read_looper_dotfile() _LOGGER.info(f"Using looper config ({looper_cfg_path}).") - sample_modifiers_dict = None cli_modifiers_dict = None for looper_config_key, looper_config_item in looper_config_dict.items(): - if looper_config_key == SAMPLE_MODS_KEY: - sample_modifiers_dict = looper_config_item - elif looper_config_key == CLI_KEY: + if looper_config_key == CLI_KEY: cli_modifiers_dict = looper_config_item else: setattr(subcommand_args, looper_config_key, looper_config_item) @@ -203,7 +200,6 @@ def run_looper(args: TopLevelParser, parser: ArgumentParser, test_args=None): amendments=subcommand_args.amend, divcfg_path=divcfg, runp=subcommand_name == "runp", - sample_modifiers=sample_modifiers_dict, **{ attr: getattr(subcommand_args, attr) for attr in CLI_PROJ_ATTRS @@ -219,7 +215,6 @@ def run_looper(args: TopLevelParser, parser: ArgumentParser, test_args=None): amendments=subcommand_args.amend, divcfg_path=divcfg, runp=subcommand_name == "runp", - sample_modifiers=sample_modifiers_dict, project_dict=PEPHubClient()._load_raw_pep( registry_path=subcommand_args.config_file ), diff --git a/looper/project.py b/looper/project.py index 6daecac1..7a652db7 100644 --- a/looper/project.py +++ b/looper/project.py @@ -131,19 +131,6 @@ def __init__(self, cfg=None, amendments=None, divcfg_path=None, **kwargs): except NotImplementedError: self.name = None - # consolidate sample modifiers - if kwargs.get(SAMPLE_MODS_KEY) and self._modifier_exists(): - _LOGGER.warning( - "Sample modifiers were provided in Looper Config and in PEP Project Config. Merging..." - ) - deep_update(self.config["sample_modifiers"], kwargs.get(SAMPLE_MODS_KEY)) - _LOGGER.debug( - msg=f"Merged sample modifiers: {self.config['sample_modifiers']}" - ) - elif kwargs.get(SAMPLE_MODS_KEY): - self.config.setdefault("sample_modifiers", {}) - self.config["sample_modifiers"] = kwargs.get(SAMPLE_MODS_KEY) - # add sample pipeline interface to the project if kwargs.get(SAMPLE_PL_ARG): self.set_sample_piface(kwargs.get(SAMPLE_PL_ARG))