Skip to content

Conversation

@oliver-sanders
Copy link
Member

@oliver-sanders oliver-sanders commented Oct 29, 2025

Closes #526

I somehow forgot that we have cylc vr support in the Tui, but not the GUI!

Trivial to add support. Supporting the cylc install command is also possible, however, that will require #512.

UI sibling: cylc/cylc-ui#2347

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).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • Changelog entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

args: Dict[str, Any],
workflows_mgr: 'WorkflowsManager',
log: 'Logger',
) -> List[Union[bool, str]]:
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed from list[bool | str] to tuple[bool, str] as this is safer for the way we are trying to use it (('msg', False) would have been acceptable before).

Comment on lines +356 to +364
try:
ret_code = proc.wait(timeout=timeout)
except TimeoutExpired as exc:
proc.kill()
ret_code = 124 # mimic `timeout` command error code
# NOTE: preserve any stderr that the command produced this
# far as this may help with debugging
out, err = proc.communicate()
err = str(exc) + (('\n' + err) if err else '')
Copy link
Member Author

@oliver-sanders oliver-sanders Oct 30, 2025

Choose a reason for hiding this comment

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

So, it turns out this timeout logic was bunk. You have to actually .kill() to process if you want it to stop.

https://docs.python.org/3/library/subprocess.html#subprocess.Popen.communicate

Additionally, this will now log the command's stderr which might be useful in the event of a timeout.


if command == 'clean': # noqa: SIM116
return await Services.clean(
self.workflows_mgr,
Copy link
Member Author

Choose a reason for hiding this comment

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

Switched arg order for consistency.

@oliver-sanders
Copy link
Member Author

FYI: style tests will fail until #748

@oliver-sanders oliver-sanders marked this pull request as ready for review October 30, 2025 16:03
@oliver-sanders oliver-sanders requested a review from wxtim October 30, 2025 16:03
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.

  • Read Code
  • Tried in practice.

n.b. I think that VR should be on the shortened list of commands, but that's a Cylc UI change

@oliver-sanders
Copy link
Member Author

oliver-sanders commented Nov 3, 2025

n.b. I think that VR should be on the shortened list of commands, but that's a Cylc UI change

There'll be a cylc-ui and cylc-doc counterpart.

@oliver-sanders oliver-sanders force-pushed the 526 branch 2 times, most recently from f8f0f51 to f6a6e5e Compare November 3, 2025 16:31
@oliver-sanders
Copy link
Member Author

@wxtim, since last review:

  • Fixed tests (hopefully)
  • Added support for the "global" option (BoM might want to use this)

oliver-sanders added a commit to oliver-sanders/cylc-ui that referenced this pull request Nov 3, 2025
* The `reload` mutation isn't the most helpful command post
  `cylc install`.
* Swap it out in the workflow command shortlist for the
  [newly added](cylc/cylc-uiserver#746)
  `validateReinstall` mutation which has wider scope.
* Closes cylc#526
* Add basic support for the `cylc vr` command.
* We were applying a timeout to the `Popen.wait` method, however, this
  doesn't actually kill the process (as one might expect) when the
  timeout elapses, it just stops waiting for it?!
''')
resolver = partial(mutator, command='validate_reinstall')

class Arguments:
Copy link
Member

@MetRonnie MetRonnie Nov 4, 2025

Choose a reason for hiding this comment

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

There are more arguments that this shares with play - worth extracting out into a class that can be inherited by both Arguments classes?

Edit: e.g.
image

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I was purposefully avoiding implementing all opts in favour of getting something simple working quickly.

My main worry is that the options valid for the command vary according to workflow state (i.e, you can only specify play opts if the workflow is stopped) and that inheriting both (along with defaults) could cause issues.

But we need to cross this bridge at some point, I'll see how hard it is...

The workflow will be reinstalled, then either:
* Reloaded (if the workflow is running),
* or restarted (if it is stopped).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* or restarted (if it is stopped).
* or restarted (if it is stopped).
Valid for: stopped, paused, running workflows.

Copy link
Member Author

Choose a reason for hiding this comment

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

Omitting this line makes it valid for all states.

I guess doing this explicitly prevents it from being called on stopping workflows which is worthwhile.

Copy link
Member

Choose a reason for hiding this comment

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

(Ah right, I thought it would be disabled if this line was not specified at all)

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 you suggestion is probably good though as it omits stopping.

"bad things!!",
["Command failed (1): cylc play", "something", "bad things!!"],
r"bad things!!.*",
["Command failed \(1\): cylc ", "something", "bad things!!"],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
["Command failed \(1\): cylc ", "something", "bad things!!"],
[r"Command failed \(1\): cylc ", "something", "bad things!!"],

@oliver-sanders
Copy link
Member Author

(drafting whilst I look at how hard it will be to combine ALL play and reload opts)

@oliver-sanders oliver-sanders marked this pull request as draft November 5, 2025 13:00
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.

services: vr (validate-reinstall-apply)

3 participants