Skip to content

Commit

Permalink
[CI/CD] global_properties will not be checked in the check_properties…
Browse files Browse the repository at this point in the history
… func
  • Loading branch information
PauAndrio committed Sep 17, 2024
1 parent ad08854 commit 1c14b52
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions biobb_common/configuration/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- **step** (*str*) - (None) Name of the step.
- **path** (*str*) - ('') Absolute path to the step working dir.
- **working_dir_path** (*str*) - (Current working dir) Workflow output directory.
- **global_properties_list** (*list*) - ([]) List of global properties.
"""

import yaml
Expand Down Expand Up @@ -109,6 +110,7 @@ def _get_step_properties(self, key: str = "", prefix: str = "", global_log: Opti
"""
prop_dic = dict()
prop_dic.update(deepcopy(self.global_properties))
prop_dic["global_properties_list"] = list(self.global_properties.keys())
prop_dic["step"] = key
prop_dic["prefix"] = prefix
prop_dic["global_log"] = global_log
Expand All @@ -135,6 +137,7 @@ def get_prop_dic(self, prefix: str = "", global_log: Optional[logging.Logger] =
| **global_log** (*Logger object*): Log from the main workflow.
| **tool** (*str*): Name of the tool to be executed, mostly used by the biobbAPI.
| **working_dir_path** (*str*): Workflow output directory.
| **global_properties_list** (*list*): List of global properties.
Args:
prefix (str): Prefix if provided.
Expand Down
6 changes: 3 additions & 3 deletions biobb_common/generic/biobb_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def __init__(self, properties=None, **kwargs) -> None: # type: ignore
self.disable_sandbox: bool = properties.get("disable_sandbox", False)

# Properties common in all BB
self.global_properties_list: List[str] = properties.get("global_properties_list", [])
self.chdir_sandbox: bool = properties.get("chdir_sandbox", False)
self.binary_path: str = properties.get("binary_path", '')
self.can_write_console_log: bool = properties.get("can_write_console_log", True)
Expand Down Expand Up @@ -119,9 +120,8 @@ def check_properties(
if not reserved_properties:
reserved_properties = set()
reserved_properties = {"system", "working_dir_path"}.union(reserved_properties)
error_properties = set(
[prop for prop in properties.keys() if prop not in self.__dict__.keys()]
)
reserved_properties = reserved_properties.union(set(self.global_properties_list))
error_properties = set([prop for prop in properties.keys() if prop not in self.__dict__.keys()])

# Check types
if check_var_typing and self.doc_properties_dict:
Expand Down
4 changes: 2 additions & 2 deletions test/unitests/test_configuration/test_confreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ def test_confreader_properties(self):
print() # Add a new line for better readability in the console
for file_name in ['config_complete', 'config_empty', 'config_nostep', 'config_nostep_globals']:
conf = ConfReader(self.paths[file_name])
assert fx.compare_object_pickle(conf.get_prop_dic(), self.paths[f'ref_{file_name}_pkl'], ignore_keys=['path', 'working_dir_path', 'sandbox_path'])
assert fx.compare_object_pickle(conf.get_prop_dic(), self.paths[f'ref_{file_name}_pkl'], ignore_keys=['path', 'working_dir_path', 'sandbox_path', 'global_properties_list'])

def test_confreader_paths(self):
print() # Add a new line for better readability in the console
for file_name in ['config_complete', 'config_empty', 'config_nostep', 'config_nostep_globals']:
conf = ConfReader(self.paths[file_name])
assert fx.compare_object_pickle(conf.get_paths_dic(), self.paths[f'ref_{file_name}_paths_pkl'], ignore_keys=['working_dir_path', 'sandbox_path'], ignore_substring='/Users/pau/projects/biobb_common/')
assert fx.compare_object_pickle(conf.get_paths_dic(), self.paths[f'ref_{file_name}_paths_pkl'], ignore_keys=['working_dir_path', 'sandbox_path', 'global_properties_list'], ignore_substring='/Users/pau/projects/biobb_common/')

0 comments on commit 1c14b52

Please sign in to comment.