-
Notifications
You must be signed in to change notification settings - Fork 712
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
Reserved network locations for Studio and KDP #12703
Reserved network locations for Studio and KDP #12703
Conversation
…eated and set location_type to static
…rkLocationViewSet
…io reserved location, excluding both if syncable is not provided
…cal is false and update previous tests that used dynamic field
Build Artifacts
|
Hi @LianaHarris360 and @marcellamaki no issues observed while regression testing the content import from studio and syncing to KDP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly just questions, as I'm not sure I understand all of the reasoning behind some of the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look correct to me! It appears there is just one clarification to take care of, otherwise all everything else seems fine to me. I'll leave the final approval to @bjester. Thanks @LianaHarris360
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for addressing the feedback so far. There's just one lingering issue with the API
kolibri/core/discovery/api.py
Outdated
if syncable == "1": | ||
# Include KDP's reserved location | ||
queryset = NetworkLocation.objects.filter( | ||
Q(location_type=LocationTypes.Static) | ||
| Q(id=DATA_PORTAL_BASE_INSTANCE_ID) | ||
) | ||
elif syncable == "0": | ||
# Include Studio's reserved location | ||
queryset = NetworkLocation.objects.filter( | ||
Q(location_type=LocationTypes.Static) | ||
| Q(id=CENTRAL_CONTENT_BASE_INSTANCE_ID) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't quite 100% to what we need. For background, the reasoning behind this filter is to return locations that either are syncable (for facility data syncing) or can be used for content import. Studio can be used for content import but syncing. KDP can be used for syncing but not content import. As coded, this wouldn't return dynamic locations, which are similar to static in that we assume they can do both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this filter should consistently return static and dynamic locations, and only include KDP/Studio reserved locations based on the syncable value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
This pull request allows the use of
NetworkLocation
models and associated architecture to interact with Studio and KDP.Details
dynamic
field and its setter from modelNetworkLocation
after migrating to fieldlocation_type
.reset_connection_states
to create or update reserved network locations for Studio and KDP using URLs from Kolibri'soptions.ini
file. Uses hardcoded IDs for these locations, resets their connection states similarly to static locations, and for KDP locations, sets the application to Kolibri Data Portal without enqueuing aperform_network_location_update
task.NetworkLocations
model to annotate a dynamic attribute on the response whenlocation_type
is dynamic, only allow static models to be created (and set thelocation_type
to static when creating them), and exclude KDP and Studio if syncable filter is not provided.Notes
update_connection_status
was not implemented.References
Closes #10431
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)