Skip to content

Commit

Permalink
Fix a bug when normalized function is called with already normalized …
Browse files Browse the repository at this point in the history
…data ( when there are multiple files this can happen) (#55)
  • Loading branch information
dbeltrankyl authored Nov 28, 2024
1 parent 8c15c0f commit dcff0ca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
15 changes: 8 additions & 7 deletions autosubmitconfigparser/config/configcommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,13 +600,14 @@ def _normalize_dependencies(dependencies: Union[str, dict]) -> dict:
aux_dependencies[dependency.upper()] = dependency_data
if type(dependency_data) is dict and dependency_data.get("STATUS", None):
dependency_data["STATUS"] = dependency_data["STATUS"].upper()
if dependency_data["STATUS"][-1] == "?":
dependency_data["STATUS"] = dependency_data["STATUS"][:-1]
dependency_data["ANY_FINAL_STATUS_IS_VALID"] = True
elif dependency_data["STATUS"] not in ["READY", "DELAYED", "PREPARED", "SKIPPED", "FAILED", "COMPLETED"]: # May change in future issues.
dependency_data["ANY_FINAL_STATUS_IS_VALID"] = True
else:
dependency_data["ANY_FINAL_STATUS_IS_VALID"] = False
if not dependency_data.get("ANY_FINAL_STATUS_IS_VALID", False):
if dependency_data["STATUS"][-1] == "?":
dependency_data["STATUS"] = dependency_data["STATUS"][:-1]
dependency_data["ANY_FINAL_STATUS_IS_VALID"] = True
elif dependency_data["STATUS"] not in ["READY", "DELAYED", "PREPARED", "SKIPPED", "FAILED", "COMPLETED"]: # May change in future issues.
dependency_data["ANY_FINAL_STATUS_IS_VALID"] = True
else:
dependency_data["ANY_FINAL_STATUS_IS_VALID"] = False

return aux_dependencies

Expand Down
2 changes: 2 additions & 0 deletions test/unit/test_deep_normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,5 @@ def test_normalize_variables(autosubmit_config, data, expected_data):
as_conf = autosubmit_config(expid='t000', experiment_data=data)
normalized_data = as_conf.deep_normalize(data)
assert normalized_data == expected_data
normalized_data = as_conf.deep_normalize(normalized_data)
assert normalized_data == expected_data
2 changes: 2 additions & 0 deletions test/unit/test_normalize_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,5 @@ def test_normalize_variables(autosubmit_config, data, expected_data, must_exists
as_conf = autosubmit_config(expid='t000', experiment_data=data)
normalized_data = as_conf.normalize_variables(data, must_exists=must_exists)
assert normalized_data == expected_data
normalized_data = as_conf.normalize_variables(normalized_data, must_exists=must_exists)
assert normalized_data == expected_data

0 comments on commit dcff0ca

Please sign in to comment.