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

Make TUI refuse to show non-installed workflows #4748

Merged

Conversation

wxtim
Copy link
Member

@wxtim wxtim commented Mar 21, 2022

These changes close #4715

Summary

When Cylc TUI is started it should check whether the workflow has actually been installed before doing anything to display it.

Requirements 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.
  • Appropriate tests are included (unit and/or functional).
  • Appropriate change log entry included.
  • Change log rebased after 8.0rc2 release.
  • No documentation update required.

@wxtim wxtim added this to the cylc-8.0rc3 milestone Mar 21, 2022
@wxtim wxtim self-assigned this Mar 21, 2022
@wxtim wxtim requested review from datamel and MetRonnie March 21, 2022 15:37
@wxtim wxtim marked this pull request as draft March 22, 2022 08:24
@wxtim wxtim force-pushed the Make_TUI_refuse_to_show_non-installed_workflows branch from 6d3e772 to d0a3f1d Compare March 22, 2022 09:36
@wxtim wxtim marked this pull request as ready for review March 22, 2022 09:36
@wxtim wxtim marked this pull request as draft March 22, 2022 15:20
@wxtim wxtim force-pushed the Make_TUI_refuse_to_show_non-installed_workflows branch from d0a3f1d to a142675 Compare April 5, 2022 14:29
@wxtim wxtim marked this pull request as ready for review April 5, 2022 14:30
@wxtim wxtim requested review from oliver-sanders and removed request for MetRonnie April 5, 2022 14:32
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.

My observations from testing out:

  • If a workflow dir does not exist, TUI refuses to load and instead you get a message
    UserInputError: Path does not exist: ~/cylc-run/dir
    
  • If the dir does exist in ~/cylc-run, but does not contain a flow.cylc or suite.rc, you get the "workflow not found" message inside TUI as expected
  • However, you still have the option to play it in the menu when you press Enter, only for it come up with an error
    WorkflowFilesError: No flow.cylc or suite.rc in ~/cylc-run/dir
    
  • Also, if the dir is a parent of a run dir, it says "workflow not found" inside TUI, which is perhaps misleading

cylc/flow/tui/app.py Outdated Show resolved Hide resolved
Co-authored-by: Ronnie Dutta <[email protected]>
@wxtim
Copy link
Member Author

wxtim commented Apr 6, 2022

@MetRonnie - Can you clarify exactly what you mean in #4715 by cylc tui non-exist? Is non-exist a non-existant workflow folder? Or a real folder without a clearly identified workflow within it?

@MetRonnie
Copy link
Member

I can't remember. Either it was a non-existent folder, which means the UserInputError is new since then, or it was an empty folder or something like that

@wxtim
Copy link
Member Author

wxtim commented Apr 6, 2022

Also, if the dir is a parent of a run dir, it says "workflow not found" inside TUI, which is perhaps misleading

Can it be the parent of a run-dir?

@MetRonnie
Copy link
Member

Also, if the dir is a parent of a run dir, it says "workflow not found" inside TUI, which is perhaps misleading

Can it be the parent of a run-dir?

Not sure what you mean. Here is an example of what I was talking about:

$ tree -L 1 ~/cylc-run/blah
~/cylc-run/blah
|-- _cylc-install
|-- run1
`-- runN -> run1

$ cylc tui blah

@wxtim
Copy link
Member Author

wxtim commented Apr 7, 2022

@MetRonnie - using the equivalent of your example I get Cylc TUI saying

temp1/run1 - workflow not found

By the point that the logic I've inserted takes place any input has been expanded to a full workflow name. Isn't this the same expansion behaviour as the rest of the CLI?

@MetRonnie
Copy link
Member

Ah, I oversimplified my example. Try this instead (another level in the directory structure):

$ cd ~/cylc-run
$ tree -L 2 foo
foo
`-- bar
    |-- _cylc-install
    |-- run1
    `-- runN -> run1

$ cylc tui foo

@oliver-sanders
Copy link
Member

My observations from testing out:

If a workflow dir does not exist, TUI refuses to load and instead you get a message
UserInputError: Path does not exist: ~/cylc-run/dir

Good

If the dir does exist in ~/cylc-run, but does not contain a flow.cylc or suite.rc, you get the "workflow not > found" message inside TUI as expected

Good

However, you still have the option to play it in the menu when you press Enter, only for it come up with an error
WorkflowFilesError: No flow.cylc or suite.rc in ~/cylc-run/dir

Fine IMO. I don't think we need to obsess about these niche cases.

Also, if the dir is a parent of a run dir, it says "workflow not found" inside TUI, which is perhaps misleading

Fine IMO, same result as you would get with any other Cylc command.

@MetRonnie
Copy link
Member

MetRonnie commented Apr 7, 2022

Perhaps "No flow.cylc or suite.rc in ~/cylc-run/dir" would be better than "Workflow not found"?

Can just use cylc.flow.workflow_files.check_flow_file() and use the string representation of the WorkflowFilesError that gets raised for no flow file

Copy link
Contributor

@datamel datamel left a comment

Choose a reason for hiding this comment

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

I have manually tested this, working well for me.

wxtim added 2 commits April 8, 2022 09:14
…hub.com:wxtim/cylc into Make_TUI_refuse_to_show_non-installed_workflows

* 'Make_TUI_refuse_to_show_non-installed_workflows' of github.com:wxtim/cylc:
  Update cylc/flow/tui/app.py
@wxtim wxtim requested review from MetRonnie and removed request for MetRonnie April 8, 2022 08:16
@wxtim wxtim merged commit e246b3c into cylc:master Apr 8, 2022
@wxtim wxtim deleted the Make_TUI_refuse_to_show_non-installed_workflows branch April 8, 2022 08:16
oliver-sanders added a commit to oliver-sanders/cylc-flow that referenced this pull request Apr 12, 2022
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.

TUI: non-existent workflows are reported as stopped
4 participants