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

Platforms: Upgrade Cylc 7 Host Syntax #3772

Merged
merged 19 commits into from
Sep 1, 2020

Conversation

wxtim
Copy link
Member

@wxtim wxtim commented Aug 13, 2020

Summary

As per the deprecation method section of the platforms proposal suite tasks where Cylc 7 syntax such as

[runtime]
  [[MY_TASK]]
    [[[job]]]
       batch system = some batch system
    [[[remote]]]
      host = myhost

should select a sensible batch system, or return a reasonable error if unable to do so.

This PR attempts to address this.

Work done

  1. Removed cylc.flow.cfgspec.suite.host_to_platform_upgrader and replaced it with an upgrade warner function to be called on workflow validation. This can't catch every possible problem, but will hopefully fail loudly if something obviously wrong is put in a config.
  2. Added the logic to a get_platform interface to the platform module: Replaced instances of platform_from_name with get_platform.
  3. Added upgrader logic to get_platform.
  4. Refactored some functional tests which I missed in the original platforms work, but now fail.
  5. Added Functional test tests/functional/validate/04-host-platform-upgrade.t - this is not meant to comprehensively test the upgrader function, merely to test that it has been plugged into the cylkc
  6. Added s unit test tests/unit/cfgspec/test_suite.py which is meant to provide comprehensive coverage of the warning function, and a unit test for get_platform to tests/unit/test_platforms.py.

@wxtim wxtim added this to the cylc-8.0a3 milestone Aug 13, 2020
@wxtim wxtim self-assigned this Aug 13, 2020
@wxtim wxtim marked this pull request as draft August 13, 2020 08:54
@wxtim wxtim force-pushed the plumbing.reverse-lookup-unit-tests branch 3 times, most recently from 9c89175 to bf70a1c Compare August 17, 2020 10:41
@wxtim wxtim requested a review from MetRonnie August 17, 2020 10:54
@wxtim wxtim marked this pull request as ready for review August 17, 2020 10:56
@wxtim wxtim requested a review from hjoliver August 17, 2020 11:33
@@ -221,9 +221,13 @@ def test_upgrader_where_host_is_function(tmp_path, caplog):
caplog.set_level(logging.DEBUG)
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why this file has been moved to functional/?

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 at one point I began to believe that this was more functional than unit, but it isn't.

Copy link
Member

@oliver-sanders oliver-sanders Aug 18, 2020

Choose a reason for hiding this comment

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

So what aspect of this test is functional?

The "line in the sand" that I have in my head is:

  • Integration - Involves the interaction of more than one significant piece of logic.
  • Functional - Involves interaction with the shell, browser or other systems.

This is why the integration test suites are started in held mode and don't involve anything that goes via the CLI.

Copy link
Member

@oliver-sanders oliver-sanders Sep 1, 2020

Choose a reason for hiding this comment

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

I think this has been moved back again or removed?

cylc/flow/cfgspec/suite.py Outdated Show resolved Hide resolved
cylc/flow/cfgspec/suite.py Outdated Show resolved Hide resolved
cylc/flow/config.py Outdated Show resolved Hide resolved
@wxtim wxtim force-pushed the plumbing.reverse-lookup-unit-tests branch 2 times, most recently from f51a918 to ee35376 Compare August 18, 2020 10:20
Copy link
Member

@MetRonnie MetRonnie left a comment

Choose a reason for hiding this comment

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

Need to go through and update *.rc -> .cylc

@hjoliver
Copy link
Member

(A few conflicts and test failures now).

@wxtim wxtim force-pushed the plumbing.reverse-lookup-unit-tests branch 2 times, most recently from 9daf8aa to e817122 Compare August 19, 2020 09:33
@wxtim wxtim marked this pull request as draft August 20, 2020 10:21
@wxtim wxtim force-pushed the plumbing.reverse-lookup-unit-tests branch from 804b815 to ea51631 Compare August 20, 2020 12:04
replace platform_from_name with get_platform where args=None

replace platform_from_name with get_platform where args!=None

fix unit tests with new syntax
allow for platform = localhost where to settings at cylc 7 or 8 have been set

removed unwanted tests for deleted method

finessing the platform lookup
…rt.t

tests: tests/functional/cylc-get-config/00-simple/section2.stdout

tests: tests/f/job-submission/10-at-shell.t

tests: tests/functional/directives/01-at.t

tests: tests/functional/job-submission/00-user.t
@wxtim wxtim force-pushed the plumbing.reverse-lookup-unit-tests branch from dced080 to 64d0265 Compare August 21, 2020 07:21
@wxtim wxtim force-pushed the plumbing.reverse-lookup-unit-tests branch from aaa3f93 to 326f3fe Compare August 24, 2020 16:38
@wxtim
Copy link
Member Author

wxtim commented Aug 25, 2020

Can I poke @oliver-sanders and @MetRonnie to have a final double check that I've answered outstanding issues?

@wxtim wxtim mentioned this pull request Aug 26, 2020
@wxtim wxtim requested a review from hjoliver August 26, 2020 13:37
@wxtim wxtim mentioned this pull request Aug 26, 2020
2 tasks
@wxtim wxtim dismissed hjoliver’s stale review August 27, 2020 08:06

You said that I couldn't do the upgrade before inheritance, but that I didn't want to warn for every failure after inheritance. So I've replaced the upgrade-on-config-loading function with a warn (fail if is deffo wrong) at config-load, then added a the upgrade logic at task job sumbit.

cylc/flow/cfgspec/suite.py Outdated Show resolved Hide resolved
cylc/flow/cfgspec/suite.py Outdated Show resolved Hide resolved
cylc/flow/platforms.py Outdated Show resolved Hide resolved
cylc/flow/platforms.py Outdated Show resolved Hide resolved
wxtim and others added 3 commits August 27, 2020 14:43
Co-authored-by: Oliver Sanders <oliver.sanders@metoffice.gov.uk>
Co-authored-by: Oliver Sanders <oliver.sanders@metoffice.gov.uk>
Comment on lines +78 to +80
# ----------------------------------------------------------------------------
# Tests of platform_from_name
# ----------------------------------------------------------------------------
Copy link
Member

Choose a reason for hiding this comment

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

Not a blocker but we shouldn't have file-dividers in code. If the file is getting so big that you feel the need to add markers to divide related logic into separate sections, consider splitting the file.

Copy link
Member

Choose a reason for hiding this comment

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

I've always hated them in the bash test scripts too 🤮 (no offense @wxtim !)

Copy link
Member Author

Choose a reason for hiding this comment

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

None Taken.

tests/unit/test_host_select.py Show resolved Hide resolved
Copy link
Member

@hjoliver hjoliver left a comment

Choose a reason for hiding this comment

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

The new upgrade logic seems a pretty good way to do this. 👍

@wxtim wxtim force-pushed the plumbing.reverse-lookup-unit-tests branch from a9551a4 to 4bb8e9c Compare August 28, 2020 07:53
@wxtim wxtim force-pushed the plumbing.reverse-lookup-unit-tests branch from 4bb8e9c to 2122c51 Compare August 28, 2020 07:55
@wxtim wxtim force-pushed the plumbing.reverse-lookup-unit-tests branch from b52428e to 93522d0 Compare August 28, 2020 14:46
@oliver-sanders
Copy link
Member

I think all outstanding comments are resolved, looks ok, merging with two approvals.

@oliver-sanders oliver-sanders merged commit 330735e into cylc:master Sep 1, 2020
@wxtim wxtim deleted the plumbing.reverse-lookup-unit-tests branch September 3, 2020 08:44
@hjoliver hjoliver modified the milestones: cylc-8.0a3, cylc-8.0b0 Feb 25, 2021
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.

4 participants