Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common notation #146

Merged
merged 4 commits into from
Nov 9, 2023
Merged

Common notation #146

merged 4 commits into from
Nov 9, 2023

Conversation

greole
Copy link
Collaborator

@greole greole commented Nov 9, 2023

This PR implements the common notation to allow writing yaml files with key values more compact

Example:

     values:
       - set: solvers/p
         preconditioner: none
         solver: GKOCG
         executor: reference
         matrixFormat: Coo
       - set: solvers/U
         preconditioner: BJ
         solver: GKOBiCGStab         
         executor: reference
         matrixFormat: Coo

can now be written as

     common:
         executor: reference
         matrixFormat: Coo
     values:
       - set: solvers/p
         preconditioner: none
         solver: GKOCG
       - set: solvers/U
         preconditioner: BJ
         solver: GKOBiCGStab         

Additionally,

  • unit tests are added
  • doc strings are expanded
  • some minor refactoring

@greole greole requested a review from lupeterm November 9, 2023 07:39
@greole
Copy link
Collaborator Author

greole commented Nov 9, 2023

format!

@greole
Copy link
Collaborator Author

greole commented Nov 9, 2023

Strange black complains, but the format action seems to be ok with the formatting. Also my local black seems to be OK with the files.

Copy link
Collaborator

@lupeterm lupeterm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, please see comments.

if not operation.get("schema"):
logging.error("Error Schema missing for Set schema to allow creating views")
raise KeyError

return operation["schema"].format(**flatten(value)) + "/"


def extract_from_operation(operation, value):
"""takes an operation"""
def extract_from_operation(operation: dict, value) -> dict:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What type could value be in this context?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current design it is either are number, string or dict. This should be refactored at some point such that it is only a number or string

@@ -142,7 +165,10 @@ def add_variations(
parent_job: Job,
id_path_mapping: dict,
) -> list:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, could you specifiy what type the list elements inherit? I assume operations would be list[str]?

base_dict = deepcopy(to_dict(parent_job.sp))

statepoint = {
"keys": keys,
"keys": parse_res["keys"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is keys always existing in parse_keys ? Or could this potentially throw a KeyError?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has always keys, since extract_from_operation always adds them.

src/obr/create_tree.py Outdated Show resolved Hide resolved
greole and others added 2 commits November 9, 2023 13:13
Co-authored-by: Lukas Petermann <60653355+lupeterm@users.noreply.github.com>
Copy link
Collaborator

@lupeterm lupeterm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright LGTM!

@greole greole merged commit dad4913 into dev Nov 9, 2023
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants