We have multiple facilities syncing to a centralized server. I have a simple script that checks for internet connectivity and does sync at boot up if there is internet connectivity. Is there a way to get a list of facilities ids that are syncing on that instance of Kolibri. I was able to find a way to pull the default facility id from github comments/issues but am struggling to find how to pull all the facilities ids.
@pateljj04 I believe what you are trying to achieve has already been implemented herein - https://github.com/cyberorg/kolibri-autosync
@shrenik - I think this syncs all facilities on the device with the centralized server. I am looking for having only one facility on a device instead of all being on the device.
@pateljj04 the script tries to sync whatever facilities are on the device to a target server with a matching “master” facility. So if a learner or coach device has one facility, only that shall get synced. If the device has more than one facility which match with the “master” server then those too will be synced.
Yet do note that all user data is being synced as of the current Kolibri implementation which may not be desirable as the data size grows. Specifying this just so you are aware.
I assume the question is about running a script on the central server where all the facilities are?
If you want to access the list of Facility ids via Python you can use this shell script:
from kolibri.core.auth.models import Facility
You can also get a complete list of the facilities on a device from the
/api/auth/facility endpoint on the device itself.
Thanks @richard yep, that is what I was looking for!