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

Jinja error in validation shows incorrect context #2572

Open
trwhitcomb opened this issue Feb 8, 2018 · 4 comments

Comments

@trwhitcomb
Copy link
Contributor

commented Feb 8, 2018

When validating a suite using Jinja2 templating commands, the error handling will print out the Jinja exception as well as the context lines. However, they don't match. Take the following suite:

#!jinja2

[scheduling]
    initial cycle point = 20171129T20

    [[dependencies]]
        [[[PT5M]]]
            graph = """
                foo => bar
            """

[runtime]
    [[root]]
        [[[environment]]]
            watch_directory = {{ watch_directory }}

    [[CheckRequests]]
        [[[environment]]]
            processing_suite = {{ processing_suite }}

When validating with no command-line Jinja options, it gives the error:

Jinja2Error:
  File "<template>", line 18, in top-level template code
UndefinedError: 'watch_directory' is undefined
Context lines:

    [[CheckRequests]]
        [[[environment]]]
            processing_suite = {{ processing_suite }}	<-- Jinja2Error

I would have expected the context lines to show the watch_directory line instead of the processing_suite variable line contexts. I've tried to reproduce this in a standalone (non-Cylc) case but so far have been unsuccessful in my quick attempts to get Jinja to throw an error for the undefined variable. I'm also not sure if this is a Cylc-specific problem or if this is passed all the way through from Jinja. If it's Jinja, feel free to close.

@matthewrmshin matthewrmshin added this to the soon milestone Feb 8, 2018

@matthewrmshin

This comment has been minimized.

Copy link
Member

commented Feb 8, 2018

On initial investigation, I think this may be a Jinja2 bug. I'll ask a 2nd pair of eyes to confirm.

@oliver-sanders oliver-sanders removed the bug label Feb 8, 2018

@oliver-sanders

This comment has been minimized.

Copy link
Member

commented Feb 8, 2018

Confirmed, this is a bad Jinja2 bug - pallets/jinja#276.

@matthewrmshin matthewrmshin modified the milestones: soon, never Feb 8, 2018

@trwhitcomb

This comment has been minimized.

Copy link
Contributor Author

commented Feb 8, 2018

Thanks, guys. I suspected it might be so - feel free to close if you'd like.

@matthewrmshin

This comment has been minimized.

Copy link
Member

commented Feb 8, 2018

@trwhitcomb We have moved this to milestone never, as a known issue related to a non-cylc bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.