-
Notifications
You must be signed in to change notification settings - Fork 21
services: validate-reinstall #746
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
base: master
Are you sure you want to change the base?
Conversation
| args: Dict[str, Any], | ||
| workflows_mgr: 'WorkflowsManager', | ||
| log: 'Logger', | ||
| ) -> List[Union[bool, str]]: |
There was a problem hiding this comment.
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).
| 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 '') |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
|
FYI: style tests will fail until #748 |
wxtim
left a comment
There was a problem hiding this 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
There'll be a cylc-ui and cylc-doc counterpart. |
f8f0f51 to
f6a6e5e
Compare
|
@wxtim, since last review:
|
* 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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * or restarted (if it is stopped). | |
| * or restarted (if it is stopped). | |
| Valid for: stopped, paused, running workflows. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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!!"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ["Command failed \(1\): cylc ", "something", "bad things!!"], | |
| [r"Command failed \(1\): cylc ", "something", "bad things!!"], |
|
(drafting whilst I look at how hard it will be to combine ALL play and reload opts) |

Closes #526
I somehow forgot that we have
cylc vrsupport in the Tui, but not the GUI!Trivial to add support. Supporting the
cylc installcommand is also possible, however, that will require #512.UI sibling: cylc/cylc-ui#2347
Check List
CONTRIBUTING.mdand added my name as a Code Contributor.setup.cfg(andconda-environment.ymlif present).?.?.xbranch.