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

Support Kolibri 0.16 tasks API #140

Merged
merged 7 commits into from
Dec 11, 2023
Merged

Support Kolibri 0.16 tasks API #140

merged 7 commits into from
Dec 11, 2023

Conversation

dbnicholson
Copy link
Member

Eventually we're going to want to update our content server to Kolibri 0.16 since it will soon be the new stable version and because it has lots of bug fixes in content handling. Unfortunately, the tasks API that's used when seeding content from the image builder changed.

Initially I changed it directly to just use the 0.16 API, but then I decided I didn't want to have a flag day. This makes the image builder support both series. In addition to some manual testing, I added some unit tests to prove it out to myself. That will let us land the necessary changes in the image builder and later update the server when we feel it's appropriate (like when 0.16.0 is finally released).

This is branched from eos5.1 to ease later backporting since we'll want to have this on all active branches.

https://phabricator.endlessm.com/T34697

The tasks in neither Kolibri 0.15 nor 0.16 marshal the `timeout` option.
We don't actually need this, though, as the default timeout of 60
seconds is fine. If the server hasn't responded in 60 seconds, there's
probably something wrong. The long timeout was added back in 32ed0f2
when we were using Fastly as a Kolibri CDN and I believed it wouldn't
respond for a long time in our unusual configuration.

https://phabricator.endlessm.com/T34697
`last_marker` will still be `None` if the first received status is
`COMPLETED`.

https://phabricator.endlessm.com/T34697
This will be used during testing to ensure seeding was not skipped.

https://phabricator.endlessm.com/T34697
This is a bit nicer from an encapsulation standpoint, but it will
primarily be used to handle different server versions more cleanly.

https://phabricator.endlessm.com/T34697
The tasks API in Kolibri 0.16 is different than 0.15, so some version
detection and version specific methods are needed to support it. One
advantage of 0.16 is that there's a single `remoteimport` API that
combines importing channel metadata and content as well as providing an
`update` argument.

https://phabricator.endlessm.com/T34697
Really this is just `pytest` right now (with `flake8` included for lack
of a better location), but this provides a place to collect more test
dependencies that's better than updating a bunch of adhoc instructions.

https://phabricator.endlessm.com/T34697
Test the eibkolibri module to ensure it works with both Kolibri 0.15 and
0.16 servers. Server responses are mocked using `requests_mock` rather
than trying to spin up either a real or fake Kolibri server.

https://phabricator.endlessm.com/T34697
@dbnicholson dbnicholson force-pushed the T34697-kolibri-0.16-api branch from 3db917c to 60c7192 Compare December 8, 2023 22:54
Comment on lines +36 to +37
KOLIBRI_0_15 = enum.auto()
KOLIBRI_0_16 = enum.auto()
Copy link
Member

Choose a reason for hiding this comment

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

A chaotic alternative would be:

        KOLIBRI_0_15 = 0.15
        KOLIBRI_0_16 = 0.16

I thought this would be rejected but actually it's completely legal and the Python documentation gives an example where enum values are tuples of floats.

https://docs.python.org/3/howto/enum.html#planet

@wjt wjt merged commit 6dbfbfd into master Dec 11, 2023
2 checks passed
@wjt wjt deleted the T34697-kolibri-0.16-api branch December 11, 2023 11:28
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.

2 participants