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

Clean gui info files #431

Merged
merged 12 commits into from
Mar 31, 2023
Merged

Clean gui info files #431

merged 12 commits into from
Mar 31, 2023

Conversation

datamel
Copy link
Contributor

@datamel datamel commented Mar 1, 2023

closes: #416

This fixes a bug whereby, if an existing ui-server is killed with a kill -9 or with a system crash, jupyter server info files (which serve as a contact file) can be left behind. This is problematic as our logic (added in #370) can select the broken server for re-use which results in the gui opening at an error page, rather than the cylc gui.

How to test
For reviewers to test (on master to reproduce the bug)...

  • clean your info files dir (~/.cylc/uiserver/info-files)
  • open a uiserver with cylc gui
  • look at info files dir, you should have two files (one .json and a html open file), take the pid from this filename
  • kill the process (kill -9 )
  • run another gui cylc gui (don't use the --new option)
  • you should get an error page instead of the cylc gui

Test again on this branch and the bug should be fixed, with a prompt asking you if you wish to remove the files (either response should result in a gui being opened correctly)

Note that this branch also changes the logic - the html open file is now no longer written to in this process, so functional testing of various gui openings (e.g. with/without --new and workflow_id) would be prudent.

  • 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).
  • CHANGES.md 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 branch.

@datamel datamel added the bug Something isn't working label Mar 1, 2023
@datamel datamel self-assigned this Mar 1, 2023
@datamel datamel requested a review from wxtim March 1, 2023 16:17
@datamel datamel marked this pull request as draft March 2, 2023 11:04
@datamel datamel marked this pull request as ready for review March 2, 2023 11:26
@codecov-commenter
Copy link

codecov-commenter commented Mar 2, 2023

Codecov Report

Patch coverage: 92.85% and project coverage change: +0.20 🎉

Comparison is base (a5bc092) 78.78% compared to head (e8c5cd3) 78.98%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #431      +/-   ##
==========================================
+ Coverage   78.78%   78.98%   +0.20%     
==========================================
  Files          12       12              
  Lines        1296     1318      +22     
  Branches      218      221       +3     
==========================================
+ Hits         1021     1041      +20     
- Misses        231      233       +2     
  Partials       44       44              
Impacted Files Coverage Δ
cylc/uiserver/scripts/gui.py 88.57% <92.85%> (+1.07%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

cylc/uiserver/scripts/gui.py Outdated Show resolved Hide resolved
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.

Needs a changelog entry. Otherwise ready to roll. :)

  • Read Change, looks sane.
  • Manually tested and found to fix bug.

@MetRonnie MetRonnie requested review from MetRonnie and removed request for dwsutherland March 30, 2023 11:04
@MetRonnie MetRonnie added this to the 1.2.2 milestone Mar 30, 2023
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.

Tested. @wxtim do you want to have a look at my comments and approve if you're ok with them being applied?

def get_url_from_file(gui_file):
with open(gui_file, "r") as f:
file_content = f.read()
url_extract_regex = re.compile('url=(.*?)\"')
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@wxtim wxtim Mar 31, 2023

Choose a reason for hiding this comment

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

🤣
(probably OK in this context)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah probably only worth doing in future if it breaks at some point

cylc/uiserver/scripts/gui.py Outdated Show resolved Hide resolved
cylc/uiserver/scripts/gui.py Outdated Show resolved Hide resolved
cylc/uiserver/tests/test_gui.py Outdated Show resolved Hide resolved
cylc/uiserver/tests/test_gui.py Outdated Show resolved Hide resolved
cylc/uiserver/tests/test_gui.py Outdated Show resolved Hide resolved
cylc/uiserver/tests/test_gui.py Outdated Show resolved Hide resolved
@MetRonnie MetRonnie merged commit 2fd690d into cylc:master Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Clean Logic for Info-Files
4 participants