-
Notifications
You must be signed in to change notification settings - Fork 94
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
Make suite context available before config parsing #2963
Conversation
(Style violations reported in T-CI) |
Apologies - Only used |
|
This is fine in principle, I think. We'd need to document that the values are as defined on the parsing host (could be confusing if users use these values in task job config instead of referencing the environment variable for evaluation at job run time?) |
(But lets see what others think, before code review). |
Ah yes, I've even used that myself 😆 ... Didn't bother looking it up again, as the issue still stands. |
And apparently this is overwritten by the task/job management prior to submission.. The comment I should have rewritten somewhere else:
Sorry, I see what you're saying now... Yes, might not be a good idea for them to use In the morning I'll add to the documentation what environmental suite context is available, in the same Jinja2 |
I thought of suffixing all of the variables with Because then Obviously sub suites are their own suites, so a different environmental suite context. |
BTW - |
Why do I have to keep kicking |
fc1c900
to
baacc46
Compare
Re-based post python 3 merge. |
baacc46
to
c10eda6
Compare
69692e5
to
40f4dad
Compare
Rebased onto reverted master.. @matthewrmshin ready for review |
@matthewrmshin thanks! how do we normally proceed? (who does the merge?) I'll create a mirror request for 7.8.x after (then I'll have this available for NIWA Ops after next release?!) |
Normally the 2nd reviewer does the merge (if the result is "approved"). I'll take another look now ... |
You can use the |
Yes (these |
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.
Approved pending suggested minor doc change.
Thanks @dwsutherland 👍 |
Whoop-whoop! cherry popped 🍒 |
Problem
In order to have information available in the environment for template filters (Jinja2 ...etc), it needs to be exported before parsing/processing the suite.rc. For example I may want to reference the installed or source directory:
With the run path not always being the same as the def/source path, and PWD not being consistent anyway, the alternative is to hard code this somewhere before running (or create some awkward workaround?).
The suite context is available locally after startup (on reload).
A test suite with the above (and below) filter might be:
Solution
There doesn't appear to be a reason why the suite context can't be set in the local environment before parsing the suite config. So this is what I've done.
However, to make the same functionality work for getting config and graph information via the CLI, I had to shift the exports out of the
schedular.py
and into theconfig.py
(rather than just exporting before the SuiteConfig instantiation).(remote host might need tested, as I didn't set that up, even though the other tests passed)
Note: if this passes standard, I'll make a branch for pull request to
7.8.x
...