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 remote resources in groups edit #104

Merged
merged 79 commits into from
Oct 5, 2018

Conversation

davidcaron
Copy link
Contributor

@davidcaron davidcaron commented Sep 17, 2018

Description

  • The remote resources are stored in a new table, with a similar structure as 'regular' resources. Another new table stores one record per service with the synchronization information (last sync, service type, service name, service id, etc.)
  • The synchronization is done every hour by a cron service, or directly in the UI if requested by the user. The time of the last synchronization is displayed in the UI.
  • The resources displayed in the 'group edit' view are either remote or local, the user doesn't need to know. Once a permission is associated with a resource in the UI, the remote resources is written to the regular Resource table.
  • The cron service will also remove from the local Resource table every resource that doesn't have any child resources and has no group or user permission associated.
  • If a resource is absent from the remote server, the UI displays a flag next to the resource, and a Clean button to remove the resource from the database. There is also a Clean all button available.

Supported services

  • Thredds
  • Geoserver
  • Project-api

Other notes

There is a direct database call from the UI in this PR. A note has been added in the code.

This is the base for a cron service to be ran periodically.
The local and remote resource tables are compared when the
view is requested.
instead of a 'resource_id'
To distinguish permission requests and 'clean_resource' requests
@davidcaron
Copy link
Contributor Author

davidcaron commented Oct 1, 2018

Everything is working locally, but magpie on colibri is down because we need to update the providers.cfg file... see https://github.com/Ouranosinc/PAVICS/pull/103

@@ -359,7 +359,8 @@ def magpie_register_services_with_db_session(services_dict, db_session, push_to_
for svc_name, svc_values in services_dict.items():
svc_new_url = os.path.expandvars(svc_values['url'])
svc_type = svc_values['type']
svc_sync_type = svc_values['sync_type']

svc_sync_type = svc_values.get('sync_type', svc_values['title'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe instead of 'title', let's default to None or other value reflecting not-implemented?

@fmigneault
Copy link
Collaborator

Routes like /users/francis/resources return "service_sync_type": "None"
Value should be either null (converted by json from None) or any corresponding 'default' value.

@davidcaron davidcaron force-pushed the sync-remote-resources-in-groups-edit branch from 9b28317 to f93d97a Compare October 2, 2018 19:31
This was referenced Oct 2, 2018
@davidcaron davidcaron mentioned this pull request Oct 3, 2018
@fmigneault fmigneault merged commit 3bcfa22 into master Oct 5, 2018
fmigneault added a commit that referenced this pull request Oct 5, 2018
@fmigneault fmigneault deleted the sync-remote-resources-in-groups-edit branch December 6, 2018 22:32
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.

3 participants