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

Sync resumption for SoUD syncs and cleanup handling #8183

Merged
merged 26 commits into from Oct 22, 2021

Conversation

bjester
Copy link
Member

@bjester bjester commented Jul 1, 2021

Summary

  • Requires morango>=0.6.5
  • Refactors sync command logic into base class
  • Updates existing sync command to inherit new base class and to output the SyncSession ID for resuming
  • Adds new resumesync command that inherits new base class and accepts a --id parameter for a SyncSession to resume
  • Refactors SoUD syncing to keep session alive, and handles cleanup on disconnect on client instance and server
  • Integrates changes from Updates to handle addition and removal of interfaces python-zeroconf-py2compat#12
  • Refactors Zeroconf handling to stop restarting it and use new Zeroconf.update_interfaces

References

Resolves: #8019

Reviewer guidance

Situations that touch areas affected by this PR:

  • Network connects/disconnects
  • Other Kolibri instances appearing/disappearing from the network
  • Setting up Kolibri (as learner-only or importing facility)
  • Kolibri starts/stops
  • Syncing to networked Kolibris
  • Syncing to KDP
  • Learner-only device recurring syncing

Scenario: Full facility

  1. Connect your device to a network/VPN with another Kolibri instance with a full facility
  2. Start a fresh install of Kolibri
  3. In the Kolibri setup wizard, choose Advanced > Import all data from an existing facility
  4. Ensure the other Kolibri instance is discovered on the network
  5. Import the facility from the other instance
  6. Finish setting up Kolibri
  7. Disconnect from the network with the other Kolibri instance
  8. From Device > Facilities, choose SYNC for the facility you imported, and select "Local network or internet"
  9. Verify that the other Kolibri instance is not shown as available, and keep the "Select network address" modal open
  10. Reconnect to the network with the other Kolibri instance
  11. Verify that the other Kolibri instance appears within 60 seconds
  12. Complete syncing with the instance

Scenario: Learner-only

  1. Connect your device to a network/VPN with another Kolibri 0.15 instance with a full facility
  2. Start a fresh install of Kolibri
  3. In the Kolibri setup wizard, choose Advanced > Import one or more user accounts from an existing facility
  4. Ensure the other Kolibri instance is discovered on the network
  5. Choose a facility and import a learner from it
  6. Finish setting up Kolibri
  7. Disconnect from the network with the other Kolibri instance
  8. Wait a few minutes
  9. Reconnect to the network with the other Kolibri instance
  10. Verify that your device (eventually) syncs the instance again

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@bjester bjester force-pushed the morango-async branch 3 times, most recently from 20b6698 to f8ffc62 Compare July 21, 2021 18:04
@bjester bjester changed the title Integration of Morango 0.6.0 changes Dedicated management command for resuming a sync with Morango 0.6.0 Jul 26, 2021
@bjester bjester linked an issue Jul 26, 2021 that may be closed by this pull request
@bjester bjester changed the title Dedicated management command for resuming a sync with Morango 0.6.0 Dedicated management command for resuming a sync with Morango 0.6.x Jul 26, 2021
@indirectlylit indirectlylit changed the base branch from develop to release-v0.15.x July 27, 2021 18:22
@indirectlylit indirectlylit added this to the 0.15.0 milestone Jul 27, 2021
…tween syncs

Fix progress handler

Keep sync session alive

Remove venv accidentally added during pre-commit fixes
@bjester bjester added the work-in-progress Not ready for review label Sep 9, 2021
@bjester bjester changed the title Dedicated management command for resuming a sync with Morango 0.6.x Sync resumption for SoUD syncs and cleanup handling Sep 9, 2021
@bjester bjester marked this pull request as ready for review September 9, 2021 17:46
@bjester bjester added TAG: dependencies Pull requests that update a dependency file TAG: performance User-facing performance TODO: needs review Waiting for review and removed work-in-progress Not ready for review labels Sep 9, 2021
Copy link
Member

@jredrejo jredrejo 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 tested it and hadn't found any problem with these changes.
Only the warning messages appearing multiple times on a not SoUD server that has been used to sync several SoUD:

INFO     Kolibri instance 'd34fa0e29c06817d732e4f7b81f3e2aa' joined zeroconf network; device info: {'application': 'kolibri', 'kolibri_version': '0.15.0a5.dev0+git.18.g94c233af', 'instance_id': 'd34fa0e29c06817d732e4f7b81f3e2aa', 'device_name': 'jose-xps', 'operating_system': 'Linux', 'subset_of_users_device': False}
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do automated SoUD syncing.
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
WARNING  Only Subsets of Users Devices can do this
INFO     Kolibri running on: http://172.17.0.1:10000/

kolibri/core/public/utils.py Outdated Show resolved Hide resolved
@bjester
Copy link
Member Author

bjester commented Oct 6, 2021

Thanks @jredrejo! That does seem to be a small regression, which I'll look into

@bjester bjester added TODO: needs review Waiting for review and removed work-in-progress Not ready for review labels Oct 6, 2021
@bjester bjester requested a review from rtibbles October 6, 2021 22:54
Copy link
Member

@jamalex jamalex left a comment

Choose a reason for hiding this comment

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

Took a peek at one specific piece, per a request, and added a comment there.

kolibri/core/auth/management/utils.py Show resolved Hide resolved
Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

Code read through makes sense to me!

self.name,
server=self.server,
address=self.ip,
port=self.port or DEFAULT_PORT,
Copy link
Member

Choose a reason for hiding this comment

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

When would we not have the port information here? (If this is just copy pasted from the previous implementation, feel free to ignore).

Copy link
Member Author

Choose a reason for hiding this comment

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

This does originate from the existing code, but I think you're right that we really don't need it

@bjester bjester requested a review from jamalex October 14, 2021 14:44
@pcenov
Copy link
Member

pcenov commented Oct 14, 2021

Hi @bjester, today I had a look at this build on Windows, Ubuntu and Android and noticed that the auto sync is not functioning at all for the learner-only devices that I've setup on both Windows and Android using Ubuntu as a server.
Here are the logs and DB files in case you are not aware of that issue:
WindowsLogsAndDB.zip
UbuntuServerLogsAndDB.zip
The other main scenario about syncing a full facility is functioning correctly. Let me know if you need any additional info.

@bjester
Copy link
Member Author

bjester commented Oct 14, 2021

Thanks @pcenov, I'm aware of that and have been debugging that issue, but the cause is still unclear

@pcenov
Copy link
Member

pcenov commented Oct 15, 2021

Tested again today on the latest Windows 10, Ubuntu and Android builds and can confirm that the sync functions correctly now.
I tried the scenarios listed in the description plus deleting the saved data on a learner-only device and restoring it to check whether it will sync back; disconnecting and reconnecting, deleting and adding resources and various other scenarios and didn't find any other issues.
I noticed that when I attempt to import a Facility or a channel from my local network I do see the Android learner-only device's URL as localhost (6b16) which seems incorrect but I don't know whether it's displayed intentionally or is a regression issue so bringing that to your attention as well.
@bjester @radinamatic

Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

Nice - the cleanup of SoUD syncing jobs on unregistering is a nice addition too!

@rtibbles rtibbles merged commit 1797f89 into learningequality:release-v0.15.x Oct 22, 2021
@rtibbles
Copy link
Member

Force merging as linting issue is resolved in #8513

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TAG: dependencies Pull requests that update a dependency file TAG: performance User-facing performance TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sync command should support resuming a SyncSession through ID argument
6 participants