-
Notifications
You must be signed in to change notification settings - Fork 11
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
Compile yaml integration and parse correctly #168
Conversation
- this is for later organization and parsing when yamls are combined
- combine model, compile, and platform yaml - parse combined yaml
- added `-e` experiment and `--execute` options - redefine variables with parsed information - createCheckout: fix checkout script running if `--execute` used and checkour script already created
- this is done in the separate tool `combine-yamls`
- certain variables were overwritten when bind mode is implemented - these variables are saved in `BACKUP` variables
9d4bb23
to
31bc40c
Compare
- accidentally removed
TO-DO:
|
- combine-yamls here if tool wasn't used
- reflects changes in `fre yamltools combine-yamls` - references defined `init_pp_yamls` class in `combine-yamls` to make combining a default behavior (on top of tool still being available if user wants to combine separately) - update schema.json for pp combined yaml
- new test for validation of combiend yamls - new fail test for if compile yaml path not correct - new fail test for if a value in the compile.yaml is not of right data type
fre/make/createCheckout.py
Outdated
# If fre yammltools combine-yamls tools was used, the combined yaml should exist | ||
if Path(combined_path).exists(): | ||
full_combined = combined_path | ||
print("\nNOTE: Yamls previously merged.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the combined yaml be overwritten each time, maybe with a message?
It seems like fre pp configure-yaml -y am5.yaml
should configure the pp workflow based on the am5.yaml but it won't if the combined-
file is there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I started to look into making it rewrite as a default, but if we wanted to keep the functionality for a user to use the tool by itself first (fre yamltools combine-yaml
), the combined yaml will already exist. Maybe we keep the creating/rewriting of the yaml as a default behavior (in compilation and pp), then have the actual tool itself just be a check of some sorts. Like if someone just wanted to see what the combined yaml would output (without doing any compilation or post-processing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that sounds good. Another option would be to compare the combined-
yaml to the one that would be re-created and give a message whether it has changed or is up-to-date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooo yeah, we could do that as well! Maybe that could be a small change in another PR. I'm pretty comfortable making it rewrite as a default behavior in this one, then making a small edit to compare yamls in another
- there was a false success with the previous schema
- update paths in test script based on reorganizations - update test_combine_yamls for validation test, wrong compile file test, wrong data type (invalid yaml) test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a README.
Address the comments and we should be good.
def __init__(self,compileinfo): | ||
""" | ||
Brief: Read get the compile yaml and fill in the missing pieces | ||
Param: | ||
- self the compile Yaml object | ||
- compileinfo dictionary with compile information from the combined yaml | ||
""" | ||
# compile information from the combined yaml | ||
self.yaml = compileinfo | ||
|
||
## Check the yaml for required things | ||
## Check for required experiment name | ||
try: | ||
self.yaml["experiment"] | ||
except: | ||
print("You must set an experiment name to compile \n") | ||
raise | ||
## Check for optional libraries and packages for linking in container | ||
try: | ||
self.yaml["container_addlibs"] | ||
except: | ||
self.yaml["container_addlibs"]="" | ||
## Check for optional libraries and packages for linking on bare-metal system | ||
try: | ||
self.yaml["baremetal_linkerflags"] | ||
except: | ||
self.yaml["baremetal_linkerflags"]="" | ||
## Check for required src | ||
try: | ||
self.yaml["src"] | ||
except: | ||
print("You must set a src to specify the sources in modelRoot/"+self.yaml["experiment"]+"\n") | ||
raise | ||
## Loop through the src array | ||
for c in self.yaml['src']: | ||
## Check for required componenet name | ||
try: | ||
c['component'] | ||
except: | ||
print("You must set the 'componet' name for each src component") | ||
raise | ||
## Check for required repo url | ||
try: | ||
c['repo'] | ||
except: | ||
print("'repo' is missing from the component "+c['component']+" in "+self.yaml["experiment"]+"\n") | ||
raise | ||
# Check for optional branch. Otherwise set it to blank | ||
try: | ||
c['branch'] | ||
except: | ||
c['branch']="" | ||
# Check for optional cppdefs. Otherwise set it to blank | ||
try: | ||
c['cppdefs'] | ||
except: | ||
c['cppdefs']="" | ||
# Check for optional doF90Cpp. Otherwise set it to False | ||
try: | ||
c['doF90Cpp'] | ||
except: | ||
c['doF90Cpp']=False | ||
# Check for optional additional instructions. Otherwise set it to blank | ||
try: | ||
c['additionalInstructions'] | ||
except: | ||
c['additionalInstructions']="" | ||
# Check for optional paths. Otherwise set it to blank | ||
try: | ||
c['paths'] | ||
except: | ||
c['paths']=[c['component']] | ||
# Check for optional requires. Otherwise set it to blank | ||
try: | ||
c['requires'] | ||
except: | ||
c['requires']=[] | ||
# Check for optional overrides. Otherwise set it to blank | ||
try: | ||
c['makeOverrides'] | ||
except: | ||
c['makeOverrides']="" | ||
# Check for optional flags. Otherwise set it to blank. | ||
try: | ||
c["otherFlags"] | ||
except: | ||
c["otherFlags"]="" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sad situation of someone else having to clean up an inexperienced python coder's mess :-(
|
||
with open(combined,'w',encoding='UTF-8') as f: | ||
yaml.safe_dump(full_yaml,f,sort_keys=False) | ||
if use == "compile": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not convinced this is the best variable name here. maybe we can bring it up at a fre meeting.
fremake README going to be pushed here: issue #187 |
All the tests pass, except one with a known cause, and a clear issue to track (#189). FAILED fre/tests/test_fre_catalog_cli.py::test_cli_fre_catalog_builder - assert False
|
it's weird that this PR messes with |
Not pertaining to test_fre_cmor_cli.py, I don't think. I'm about to check if I have to update my branch from main at all. |
Otherwise, the cmor test will fail when run afterwards
looks good, merging! |
Describe your changes
Issue ticket number and link (if applicable)
Associated with issue #141
Checklist before requesting a review