-
Notifications
You must be signed in to change notification settings - Fork 24
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
Silent failure in uw templater rendering when incorporating jinja2 macros in latest UFS SRW Application #422
Comments
Hi @mkavulich, and thank you for the report. I see what's happening and am discussing with the I haven't used Jinja's More soon... |
We have a plan to implement this feature. (For readers with EPIC Jira access: UW-523.) We'll try to get it in our upcoming v2.1.0 release. If you're using If you're using |
@maddenp-noaa I just wanted to provide some background info. This issue arose when I tried to use jinja2 macros with a relatively recent version of the uwtools CLI in the SRW App. Here's the PR that gives a lot more detail. The odd thing is that an older version of uwtools (not a CLI; it was just the uwtools repo cloned within the SRW App) was working with the macros. When I updated my PR to the latest develop branch of the SRW that brought with it the conda installation of various python packages and the uwtools CLI, the macros no longer worked and I got the behavior @mkavulich described above. Part (maybe all) of the problem might be a mismatch between the version of jinja2 that uwtools expects (the one in the conda installation) and the one that the SRW App uses in spack-stack-1.5.0. If interested, you can read the details of what I've tried in that PR. I'm happy to provide more info if that will help. Thanks. |
@gsketefian Thanks for this, very helpful. I'll look at the older |
Hi @maddenp-noaa FYI the SRW App code manager Michael Leuken ran a test of my PR #1005 using the version of jinja2 that the uwtools CLI expects, and the failure is still there. The PR has more details of what he did. So apparently it's not (just?) a version issue. |
I believe I see what needs to be done in |
I have a potential update to
Is this the expected behavior given these files? It seems intentional. Please let me know if not, but otherwise please feel free to test with my SRW install. I've tried to open up permissions sufficiently. If things look ok, I could give you a recipe for updating your own SRW install with this The update works as follows: By default, the directory containing the template file (identified by |
@maddenp-noaa Thanks for getting to this quickly! I believe that error is expected given the minimal example I provided. Unfortunately I have the "Hera is down" blues today and that's where my work is staged so I will have to wait until tomorrow to check that it works in the context of the SRW branch I'm working on. |
@maddenp-noaa Yes, thank you for coming up with a fix so soon! I'm assuming you didn't run one of the workflow-end-to-end (WE2E) tests in the SRW App to get that message; you just ran that command on the command line. If so, that would explain the error message, which (if I remember right) is coming from the jinja2 macros file. I would like to test your fix on my PR (#1005) when Hera is back up. Will it work if I simply replace the uwtools directory in the conda build that the SRW requires with your version? Or are there other packages to update as well? If the update requires changes in other calls to uwtools in the SRW, it may be that we'll have to first open a new PR into the app to update uwtools (along with appropriate tests), and, once that's merged, re-test my PR. Still, I'd like to test my PR with your fix to see whether it at least works for the WE2E tests that I'm running, so it would be great if you could send that recipe for updating uwtools. Thanks! |
@gsketefian You should be able to test by replacing any Alternatively, I think you could rename your I think one of those would be easiest to try first, but I can give you an recipe for updating your own installation with the test |
We've incorporated this fix into today's v2.1.0 release. You can install this version into an existing, activated conda environment with
As before, it's possible that other CLI invocations of or API calls into |
From following ticket traffic elsewhere, it sounds like this is working as expected. If I don't hear objections in the next couple days, I'll close this ticket. Thanks again for the report. |
@maddenp-noaa FYI Gerard was on vacation this week so I assume he hasn't had a chance to test it for his PR yet. |
Expected behavior
uw template render
tool should be able to handle rendering jinja with macros.Current behavior
UW tools fails silently with exit status 1, creating an empty file instead of a populated template.
Machines affected
Testing was done on Hera, but this shouldn't be platform-specific.
To Reproduce
Download files provided to replicate issue (you will need to remove the
.txt
extension before running):macros.jinja.txt
met_plus_settings.yaml.txt
GridStat_or_PointStat.conf.txt
Run templater command, and observe error condition described above:
Note that removing the import command results in a successful template render, so this seems to be the culprit.
Context
See also discussion in ufs-community/ufs-srweather-app#1005
The text was updated successfully, but these errors were encountered: