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

cylc play (restart): fix bug affecting run host reinvocation after interactive upgrade #6267

Merged
merged 3 commits into from
Aug 6, 2024

Conversation

MetRonnie
Copy link
Member

@MetRonnie MetRonnie commented Jul 30, 2024

Fixes a bug not recorded in an issue. I think this bug has been present since the introduction of the interactive upgrade mechanism (#5074)

TL;DR - remote reinvocation would not work after interactively upgrading a workflow to a new Cylc version on the CLI.

Steps to reproduce

With run hosts configured in global.cylc

[scheduler]
    [[run hosts]]
        available = <server1>, ...

Start a workflow and stop it, then fiddle the workflow DB to make it look like it was run with an older version:

sqlite3 wflow/.service/db 'UPDATE workflow_params SET value="8.1.7" WHERE key="cylc_version"'

Now restart it with cylc play, and type 'y' at the interactive upgrade prompt. When it re-invokes on the run host, you should see an error

This workflow was previously run with 8.1.7.
This version of Cylc is 8.3.4.dev
Use "--upgrade" to upgrade the workflow.
ERROR: ERROR: command terminated by signal 1: ssh ...

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).
  • No dependency changes
  • Tests are included
  • Changelog entry included if this is a change that can affect users
  • No docs entry needed
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@MetRonnie MetRonnie added the bug Something is wrong :( label Jul 30, 2024
@MetRonnie MetRonnie added this to the 8.3.4 milestone Jul 30, 2024
@MetRonnie MetRonnie self-assigned this Jul 30, 2024
@MetRonnie MetRonnie force-pushed the upgrade-reinvoke-2 branch 2 times, most recently from 807cf3f to dd3a5ce Compare July 30, 2024 11:53
@MetRonnie
Copy link
Member Author

Test failures just macos functional issues and flaky integration test fixed by #6257

@MetRonnie MetRonnie force-pushed the upgrade-reinvoke-2 branch from db822fe to 4b84735 Compare July 31, 2024 09:27
Copy link
Member

@wxtim wxtim left a comment

Choose a reason for hiding this comment

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

👍🏼

cylc/flow/scheduler_cli.py Show resolved Hide resolved
options.upgrade,
options.downgrade,
):
if not _version_check(db_file, options):
Copy link
Member

@oliver-sanders oliver-sanders Aug 6, 2024

Choose a reason for hiding this comment

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

FYI, I purposefully did not propagate the options object down the call chain. IMO it's a good idea to abstract out the CLI interfaces higher up in the call chain to keep the underlying code more abstract. The more you propagate CLI logic down the call stack, the harder it is to, for example, open a Python API later, or create a wrapper command, you also need to mock more in order to test and typing is less effective too (we know we're getting a Values object, but we don't know whether it has an upgrade option.

Not a blocker, but better before IMO.

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 ideally we want to only alter options.upgrade in the case of an interactive upgrade, so the simplest way of doing this is passing in the options object to _version_check.

It is a shame about the type-looseness of it, but at least it is relatively easy to test these functions by importing and using RunOptions (no need for mocking).

class Options:
"""Wrapper to allow Python API access to optparse CLI functionality.

Copy link
Member

Choose a reason for hiding this comment

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

options.update = _version_check(db_file, options.upgrade, options.downgrade) would have done it?

Copy link
Member Author

Choose a reason for hiding this comment

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

There are pathways it returns True without interactive upgrade

@oliver-sanders oliver-sanders merged commit a433765 into cylc:8.3.x Aug 6, 2024
25 of 27 checks passed
@MetRonnie MetRonnie deleted the upgrade-reinvoke-2 branch August 6, 2024 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :(
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants