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

Fix global config default-to-localhost. #3508

Merged
merged 5 commits into from
Apr 14, 2020

Conversation

hjoliver
Copy link
Member

@hjoliver hjoliver commented Mar 3, 2020

These changes close #3507

In global config host settings, default-to-localhost was broken for list-valued items. In the spec, these need to default to None (It was empty list looks like "item-set-to-nothing" rather than "item-not-set").

Apparently broken in 7.8.0 ?

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 (unit and/or functional).
  • Appropriate change log entry included.
  • No documentation update required. (Fix conforms to documented behaviour).

Once finished, this needs to go to 7.9.x as well. But not to master as the platforms changes will render this irrelevant there? - ping @wxtim

@hjoliver
Copy link
Member Author

hjoliver commented Mar 3, 2020

Global config, set all list items:

[hosts]
   [[localhost]]
      copyable environment variables = FOO, BAR
      task event handler retry delays = PT99S, PT1H
      retrieve job logs retry delays = PT10S, PT30S, PT1M, PT3M
      submission polling intervals = PT10S, PT30S
      execution polling intervals = PT10S, PT30S
      [[[batch systems]]]
         [[[[pbs]]]]
            execution time limit polling intervals = PT10S, PT30S
   [[foo]]
      # (default to localhost!)

On 7.8.x:

$ cylc get-global -i '[hosts][foo]' | egrep '(delay|variable|interval)s'
copyable environment variables = 
task event handler retry delays = 
retrieve job logs retry delays = 
submission polling intervals = 
execution polling intervals = 

On this branch:

$ cylc get-global -i '[hosts][foo]' | egrep '(delay|variable|interval)s'
copyable environment variables = FOO, BAR
task event handler retry delays = PT1M39S, PT1H
retrieve job logs retry delays = PT10S, PT30S, PT1M, PT3M
submission polling intervals = PT10S, PT30S
execution polling intervals = PT10S, PT30S

TODO - batch system settings are still not defaulting to localhost. Reason:
globalcfg:transform() needs to distinguish empty dict from None and recurse into sub-sections to do the localhost defaulting.

@hjoliver hjoliver self-assigned this Mar 3, 2020
@hjoliver hjoliver added this to the cylc-7.8.x milestone Mar 3, 2020
@hjoliver hjoliver modified the milestones: cylc-7.8.x, cylc-7.8.5 Apr 1, 2020
@hjoliver
Copy link
Member Author

hjoliver commented Apr 9, 2020

Ready to go for 7.8.5 (Note this is a real bug, reported by a user at another site).

@kinow - can you review at this end - I based my unit test on your cylc-7 suite config unit tests.

@hjoliver hjoliver requested a review from kinow April 9, 2020 00:06
@hjoliver
Copy link
Member Author

hjoliver commented Apr 9, 2020

NOTE: this bit is still broken (from description above):

TODO - batch system settings are still not defaulting to localhost. Reason:
globalcfg:transform() needs to distinguish empty dict from None and recurse into sub-sections to do the localhost defaulting.

It's probably not hard to fix, but I need to move on to other things and users are unlikely to hit it (would anyone really set batch system settings for multiple hosts under localhost?).

So I'll flag it as a new low-priority issue.

@hjoliver hjoliver requested a review from wxtim April 9, 2020 00:09
@hjoliver
Copy link
Member Author

hjoliver commented Apr 9, 2020

I won't replicate this to 7.9.x - we can do the 7.9.0 release by copying 7.8.x at the last minute and applying the Jinja2 fix as discussed in our recent meeting.

@hjoliver
Copy link
Member Author

hjoliver commented Apr 9, 2020

@wxtim - this is irrelevant for cylc 8, right?

Copy link
Member

@kinow kinow left a comment

Choose a reason for hiding this comment

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

Code looks good to me, and thanks for the extra comment with the example configuration and what works and what doesn't. Easier to review.

Copied your example to my ~/.cylc/global.rc, then with 7.8.4

kinow@ranma:/opt/cylc$ ./usr/bin/cylc version
7.8.4-49-gcab35
kinow@ranma:/opt/cylc$ ./usr/bin/cylc get-global -i '[hosts][foo]' | egrep '(delay|variable|interval)s'
copyable environment variables = 
task event handler retry delays = 
retrieve job logs retry delays = 
submission polling intervals = 
execution polling intervals =

And with this branch:

kinow@ranma:/opt/cylc$ ./usr/bin/cylc version
7.8.4-51-g28c34
kinow@ranma:/opt/cylc$ git status
On branch pr-3508
nothing to commit, working tree clean
kinow@ranma:/opt/cylc$ ./usr/bin/cylc get-global -i '[hosts][foo]' | egrep '(delay|variable|interval)s'
copyable environment variables = FOO, BAR
task event handler retry delays = PT1M39S, PT1H
retrieve job logs retry delays = PT10S, PT30S, PT1M, PT3M
submission polling intervals = PT10S, PT30S
execution polling intervals = PT10S, PT30S

With Cylc 8 I get the same as Cylc 7.8.x but looks like it's not important right now (from reading @hjoliver 's comment).

@kinow
Copy link
Member

kinow commented Apr 9, 2020

@hjoliver I think the unit test will need some more work

lib/cylc/tests/test_global_config.py::TestGlobalConfig::test_localhost_default_list_items FAILED [ 10%]

(which works locally for me 👀 )

@hjoliver
Copy link
Member Author

hjoliver commented Apr 9, 2020

With Cylc 8 I get the same as Cylc 7.8.x but looks like it's not important right now (from reading @hjoliver 's comment)

Yeah, what I meant there was the defaulting to localhost is going to go away with the upcoming "Platforms" changes.

@hjoliver
Copy link
Member Author

hjoliver commented Apr 9, 2020

@hjoliver I think some unit tests will need some more work

lib/cylc/tests/test_global_config.py::TestGlobalConfig::test_localhost_default_list_items FAILED [ 10%]

Damn it, passes locally:

[oliverh@niwa-1007885 cylc-flow-7.8.x]$ git status                                                       │
On branch fix-localhost-inherit                                                                          │commit cab3598a2dad80e31872938ae7c29d2669f384bd (7.8.x)
nothing to commit, working tree clean                                                                    │Author: Hilary James Oliver <h.oliver@niwa.co.nz>
[oliverh@niwa-1007885 cylc-flow-7.8.x]$ python lib/cylc/tests/test_global_config.py                      │Date:   Thu Apr 9 10:20:12 2020 +1200
.                                                                                                        │
----------------------------------------------------------------------                                   │    Updated cylc-7 release process.
Ran 1 test in 0.004s                                                                                     │
                                                                                                         │commit 3c2bda66fbd1bd5adbabb5aca77f54bbed456d55
OK               

@kinow
Copy link
Member

kinow commented Apr 9, 2020

Ditto for me, just synced repo and imported in PyCharm, it runs fine.

@kinow
Copy link
Member

kinow commented Apr 9, 2020

@hjoliver did a few hacks on a branch, and pushed to my fork.

Running locally, the very first key that I get is 'task event handler retry delays' in that for loop. It appears to be the same in Travis. It fails the assertion (I added a print for host_item and key)

self.assertTrue(host_item == coercer(items[key], []),
                            "host_item=%s, key=%s" % (host_item, key))

and prints

>                               "host_item=%s, key=%s" % (host_item, key))
E                               AssertionError: host_item=[], key=task event handler retry delays

Locally, my host_item is different.

image

Not sure if you are able to guess anything from this @hjoliver ? I'm still not sure why Travis is unhappy :/

@kinow
Copy link
Member

kinow commented Apr 9, 2020

Tested on bionic (18.04 Ubuntu) but issue still happens there too. 🤔

@hjoliver
Copy link
Member Author

hjoliver commented Apr 9, 2020

Yeah, weird, I don't get it 😬

@hjoliver
Copy link
Member Author

hjoliver commented Apr 9, 2020

The unit test now passes on Travis 😌

@hjoliver
Copy link
Member Author

hjoliver commented Apr 9, 2020

Travis passed 🎉

@wxtim
Copy link
Member

wxtim commented Apr 14, 2020

@wxtim - this is irrelevant for cylc 8, right?

YES!

@wxtim wxtim merged commit 1eb3a62 into cylc:7.8.x Apr 14, 2020
@hjoliver hjoliver deleted the fix-localhost-inherit branch April 15, 2020 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants