Upgrading (or downgrading) Cylc version

Hi all,

I know there is cylc play --upgrade to tell cylc to upgrade the version. From what I can see, if you have a running suite and you want to upgrade the Cylc version, this would require, for example.

cylc stop my_workflow

# Re-install to bring over other changes which are coming at the same time (optional)
cylc vr --upgrade ....

Is this the correct procedure?

Also, how does one find out the CYLC_VERSION used to install a workflow which is stopped? cylc get-workflow-version only works on running workflows and there is no contact file to look in (and thus cylc get-workflow-contact can’t work), but, if I naively do a cylc vr on a workflow which is stopped, using an older CYLC_VERSION for example, I get this error.

Reinstall would make the above changes.
Continue [y/n]: REINSTALLED workflow from location
Successfully reinstalled.
$ cylc play -q workflow
It is not advisible to restart a workflow with an older version of Cylc than it was previously run with.
* This workflow was previously run with 8.3.1.
* This version of Cylc is 8.3.0.
Use --downgrade to disable this check (NOT RECOMMENDED!) or use a more recent version e.g:
$ CYLC_VERSION=8.3.1 play -q workflow

Yes at start-up (for a restart) cylc play detects that its own version is different from that recorded in the workflow DB, and prompts you whether to continue or not. The --upgrade option skips the prompt and just does it.

if you have a running suite and you want to upgrade the Cylc version, this would require, for example … [stop the scheduler, then restart it with the new version]

Correct.

If the scheduler log is still available, the easiest way is:

$ cylc log my-wflow | grep version
2024-07-09T14:46:55+12:00 INFO - Cylc version: 8.4.0.dev

Otherwise it’s recorded in the run DB:

$ sqlite3 ~/cylc-run/my-wflow/runN/log/db \
    "select value from workflow_params where key='cylc_version'"
8.4.0.dev

And in comments in the parsed start-up configs:

$ grep -i version log/config/*
log/config/01-start-01.cylc:# cylc-version: 8.3.0
log/config/02-restart-02.cylc:# cylc-version: 8.4.0.dev

Thanks, the DB option I feel is the most reliable.

I’ve found that cylc vr does not work if you make use of -S or -O options as they are no longer passed through. A bug report has been raised. This is making it difficult for me to upgrade installed workflows to the latest versions - I could by not using vr, but would prefer to avoid going down that path.

I’ve responded to the ticket - it looks like it’s only the restart step of VR is broken so as a quick fix to get around it for now use:

cylc play myworkflow

You can check that worked by looking at cylc log -f p myworkflow

Is this the correct procedure?

To upgrade a workflow:

cylc stop <workflow>
cylc play <workflow> --upgrade

We would like to automate this, something along the lines of cylc upgrade <workflow> in order to make this easier. We may be able to flag workflows running with older versions of Cylc in the GUI and provide a button to upgrade them. Easier upgrade for users · Issue #5209 · cylc/cylc-flow · GitHub

Reinstalling the workflow (e.g. using cylc vr) is not necessary unless you also want to update your installation to reflect changes in the workflow source directory.

As per the CLI, downgrading is not advisable (we have database upgraders, but not downgraders), however, we haven’t blocked it outright incase it is ever needed (mainly by developers).

Downgrading could be needed operationally if a deployment to production fails and you are required to rollback for whatever reason.

Downgrading a workflow between bugfix releases will likely work, however, there is no guarantee that it will. This has never been a supported use case in Cylc which is why the CLI now protects you from doing it accidentally.