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

Fixed 3 related parsec/template var issues #4462

Closed
wants to merge 0 commits into from

Conversation

wxtim
Copy link
Member

@wxtim wxtim commented Oct 12, 2021

  • Template variables from plugins should not be added to global configs.
  • Plugins should not be used if ROSE_SUITE_VARIABLES already in template vars.
  • Users shouldn't see unecessary traceback caused by the second issue.

This is a small change with no associated Issue.

Requirements check-list

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Appropriate tests are included (doctest).
  • No change log entry required (small fix at beta)
  • No documentation update required.

>>> merge_template_vars(a, b)
{'FOO': 42, 'BAR': 'Hello World', 'ROSE_SUITE_VARIABLES': {}}

Templating hasn't been detected by a plugin, so we don't do anything:
Copy link
Member Author

Choose a reason for hiding this comment

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

This seems like an obvs test case I'd previously missed.

cylc/flow/parsec/fileparse.py Outdated Show resolved Hide resolved
"""
fpath = Path(fpath)
Copy link
Member Author

Choose a reason for hiding this comment

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

Not strictly necessary, but I like pathlib, and feel that this is safer in the long run.

@wxtim wxtim self-assigned this Oct 12, 2021
@wxtim wxtim added the small label Oct 12, 2021
@wxtim wxtim added this to the cylc-8.0rc1 milestone Oct 12, 2021
if plugin_result['templating_detected'] is not None:
if (
plugin_result['templating_detected'] is not None
and 'ROSE_SUITE_VARIABLES' not in native_tvars
Copy link
Member

Choose a reason for hiding this comment

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

Is this not a bug in cylc-rose?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

@wxtim wxtim Oct 19, 2021

Choose a reason for hiding this comment

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

I'm not sure why I thought otherwise, although there may be a reason - Will investigate

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that this needs to be here because the plugin is not given any knowledge of template variables already in Cylc, so the plugin knows not whether it has been run before.

Copy link
Member

@oliver-sanders oliver-sanders Oct 20, 2021

Choose a reason for hiding this comment

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

Hmmm, had a look at cylc-rose, couldn't find any way for it to set ROSE_SUITE_VARIABLES twice for one pre_configure call.

Jammed some print statements into cylc-flow, seems the pre_configure plugins are being called twice, once in cylc.flow.parsec.fileparse and once in cylc.flow.templatevars which means we would hit this issue with any plugin that sets templatevars.

I'm not sure why we do this in two places, perhaps there's some odd functionality relying on it being done in templatevars?

Copy link
Member Author

@wxtim wxtim Oct 21, 2021

Choose a reason for hiding this comment

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

Jammed some print statements into cylc-flow, seems the pre_configure plugins are being called twice, once in cylc.flow.parsec.fileparse and once in cylc.flow.templatevars which means we would hit this issue with any plugin that sets templatevars.

Sorry, I could have told you this without you having to investigate.

I think that I made this happen when I enabled Cylc (conf/view/list/..) work on uninstalled workflows at #4293 : The correct answer is probably to differentiate between installed and uninstalled workflows in the scripts, and only call it in the script if the workflow isn't installed.

What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've converted this PR back into a draft until I've actually fixed the main problem.

@wxtim wxtim marked this pull request as draft October 27, 2021 08:14
@wxtim wxtim closed this Nov 10, 2021
@wxtim wxtim mentioned this pull request Nov 10, 2021
7 tasks
@oliver-sanders oliver-sanders removed this from the cylc-8.0rc1 milestone Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants