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

Compare version with network version on launch, and add Update Pepys option #1092

Merged
merged 13 commits into from
Dec 6, 2021

Conversation

robintw
Copy link
Collaborator

@robintw robintw commented Nov 25, 2021

🧰 Issue

Fixes #1035

🚀 Overview:

Adds functionality to compare the current Pepys version to the version of a 'master' network install on Pepys launch, and give an error if the network version is newer. Also add an Update Pepys Start Menu item which can be run to copy the network install to the local install directory.

🔗 Link to preview (or screenshot, if relevant)

🤔 Reason:

Help the users keep Pepys versions up-to-date while running the code locally so that it is faster.

🔨Work carried out:

  • Add checks between local version and network version on launch
  • Add Update Pepys Start Menu entry
  • Tests pass

🖥️ Screenshot

Confirmations

  • I have chosen reviewers for my PR.
  • I have chosen an appropriate label for the PR, adding interactive_review if reviewers will need to see UI
  • I have extended/updated the documentation in \docs folder
  • Any database content changes (Create, Edit, Delete) are recorded in the Log/Changes tables
  • Any database schema changes are implemented via alembic revision transitions
  • I have completed the mandatory sections of this document.
  • I have deleted any unused sections.

📝 Developer Notes:

@IanMayo IanMayo temporarily deployed to pepys-timeli-check-netw-tslzqn November 25, 2021 10:47 Inactive
@codecov
Copy link

codecov bot commented Nov 25, 2021

Codecov Report

Attention: Patch coverage is 29.62963% with 19 lines in your changes missing coverage. Please review.

Project coverage is 79.72%. Comparing base (a538092) to head (b49184d).
Report is 121 commits behind head on develop.

Files Patch % Lines
pepys_import/utils/data_store_utils.py 7.69% 12 Missing ⚠️
pepys_import/core/store/data_store.py 46.15% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1092      +/-   ##
===========================================
- Coverage    79.84%   79.72%   -0.13%     
===========================================
  Files          109      109              
  Lines        11651    11678      +27     
===========================================
+ Hits          9303     9310       +7     
- Misses        2348     2368      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@robintw robintw temporarily deployed to pepys-timeli-check-netw-tslzqn November 29, 2021 17:00 Inactive
@robintw robintw temporarily deployed to pepys-timeli-check-netw-tslzqn November 29, 2021 17:24 Inactive
@robintw robintw temporarily deployed to pepys-timeli-check-netw-tslzqn November 29, 2021 17:26 Inactive
@robintw robintw temporarily deployed to pepys-timeli-check-netw-tslzqn November 29, 2021 17:27 Inactive
@robintw
Copy link
Collaborator Author

robintw commented Nov 29, 2021

@IanMayo This all seems to be working now, based on tests on my Windows machine, but I'd appreciate you testing it too.

To test, you will need to do something like this on a Windows machine:

  1. Copy your Pepys Install folder to another folder somewhere called something like network-pepys. This will be the fake network copy that we'll be comparing to, and copying from.
  2. Modify the __init__.py file inside the pepys_import folder in this copy to change the version number to something higher than the current (eg. 1.0.0)
  3. Modify the Pepys config file so that there is a new section like this at the end
[network]
master_install_path = c:\network-pepys

(replace the path with the path to your fake network version)
4. Run Pepys Admin or Pepys Import, you should get an error saying that the network version is newer.
5. Run Upgrade Pepys from the Start Menu. It should say that it is copying from the fake network location, and then print out a list of files it is copying as it copies them.
6. Run Pepys Admin again, and you should see that it has been upgraded to the new version - with the new version number displayed in the welcome banner.

Can you have a go and let me know how you get on. Once you've confirmed it is working, we'll need to work with the clients to get it working on their system, with the config file set up correctly etc.

@IanMayo
Copy link
Member

IanMayo commented Dec 2, 2021

@robintw - did you consider deleting some (or all) local files before copying the new ones over?

If we rename a source-code file in Pepys, the previous one will still be there. This could be relevant for importers - since a previous (broken) one may still be present in the folder, and get used.

Clearly if an analyst puts their own importer in the folder, or modifies an official version they'll lose their changes. I've just looked, but didn't find any documentation on a 'user' importer folder - where locally developed importers would be stored. Do you remember that at all?

@robintw robintw temporarily deployed to pepys-timeli-check-netw-tslzqn December 2, 2021 20:43 Inactive
@robintw robintw temporarily deployed to pepys-timeli-check-netw-tslzqn December 2, 2021 21:11 Inactive
@robintw
Copy link
Collaborator Author

robintw commented Dec 2, 2021

@IanMayo Good point.

I've updated the PR so that it now deletes the contents of the folder before copying the new version across. I've tested it and it works. You'll see from the code that it deletes things in a couple of steps, as Powershell/cmd.exe seems to want to keep hold of the bin folder even when you change directory out of it. We get around that by not actually deleting the bin folder, just deleting all the other folders, and then deleting the contents of the bin folder but not the folder itself. Seems to work fine.

@robintw robintw marked this pull request as ready for review December 2, 2021 21:16
@IanMayo IanMayo temporarily deployed to pepys-timeli-check-netw-tslzqn December 6, 2021 10:23 Inactive
@IanMayo
Copy link
Member

IanMayo commented Dec 6, 2021

This just worked fine, thanks @robintw. The wrong version was identified. When I ran Upgrade Pepys - it deleted the local instance (taking almost a minute to delete the Python folder), then copied in the new version.

One issue, we have mixed language: the CLI advises me to run the Update Pepys program, but the item in the Start Menu is called Upgrade Pepys.

I'll modify the CLI message.

@IanMayo IanMayo temporarily deployed to pepys-timeli-check-netw-tslzqn December 6, 2021 10:50 Inactive
@IanMayo IanMayo temporarily deployed to pepys-timeli-check-netw-tslzqn December 6, 2021 12:53 Inactive
@IanMayo IanMayo temporarily deployed to pepys-timeli-check-netw-tslzqn December 6, 2021 13:42 Inactive
@IanMayo IanMayo temporarily deployed to pepys-timeli-check-netw-tslzqn December 6, 2021 13:47 Inactive
Copy link
Member

@IanMayo IanMayo left a comment

Choose a reason for hiding this comment

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

Tested & working

@IanMayo IanMayo merged commit b83c069 into develop Dec 6, 2021
@IanMayo IanMayo deleted the check-network-version branch December 6, 2021 15:09
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.

Delay associated with running Pepys across network
2 participants