Skip to content

Commit

Permalink
fix accessing looper.pep_config #424, add building out looper namespa…
Browse files Browse the repository at this point in the history
…ce based on config file #423
  • Loading branch information
donaldcampbelljr committed Oct 23, 2023
1 parent d99ad5f commit 99d2a8f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions looper/cli_looper.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ def main(test_args=None):
project_dict=PEPHubClient()._load_raw_pep(
registry_path=args.config_file
),
pep_config=args.config_file,
**{
attr: getattr(args, attr) for attr in CLI_PROJ_ATTRS if attr in args
},
Expand Down
4 changes: 3 additions & 1 deletion looper/conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,9 @@ def _build_looper_namespace(self, pool, size):
:return yacman.YAMLConfigManager: looper/submission related settings
"""
settings = YAMLConfigManager()
settings["pep_config"] = self.prj.config_file
settings["config_file"] = self.prj.config_file
settings["pep_config"] = self.prj.pep_config

settings[RESULTS_SUBDIR_KEY] = self.prj.results_folder
settings[SUBMISSION_SUBDIR_KEY] = self.prj.submission_folder
settings[OUTDIR_KEY] = self.prj.output_dir
Expand Down
6 changes: 4 additions & 2 deletions looper/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@ def __init__(
):
super(Project, self).__init__(cfg=cfg, amendments=amendments)
prj_dict = kwargs.get("project_dict")
pep_config = kwargs.get("pep_config", None)

# init project from pephub:
# init project from pephub pep_config:
if prj_dict is not None and cfg is None:
self.from_dict(prj_dict)
self["_config_file"] = os.getcwd()
self["_config_file"] = os.getcwd() # for finding pipeline interface
self["pep_config"] = pep_config

self[EXTRA_KEY] = {}

Expand Down
3 changes: 0 additions & 3 deletions looper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,6 @@ def read_looper_config_file(looper_config_path: str) -> dict:
dp_data = yaml.safe_load(dotfile)

if PEP_CONFIG_KEY in dp_data:
# Looper expects the config path to live at looper.config_file
# However, user may wish to access the pep at looper.pep_config
return_dict[PEP_CONFIG_KEY] = dp_data[PEP_CONFIG_KEY]
return_dict[PEP_CONFIG_FILE_KEY] = dp_data[PEP_CONFIG_KEY]

# TODO: delete it in looper 2.0
Expand Down

0 comments on commit 99d2a8f

Please sign in to comment.