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

Add a mechanism for plugging in task queues #549

Merged
merged 9 commits into from
May 6, 2022
Merged

Add a mechanism for plugging in task queues #549

merged 9 commits into from
May 6, 2022

Conversation

kaedroho
Copy link
Contributor

@kaedroho kaedroho commented Mar 28, 2022

This implements a lightweight tasks API that allows heavy tasks like translating subtrees and synchronising locale trees to be performed by a background worker.

The API is subset of the background workers API that's proposed for Wagtail core in RFC 72: wagtail/rfcs#72. So hopefully this would be easy to port over to the official core implementation later on.

This feature is sponsored by YouGov.

@@ -57,9 +53,7 @@ def __init__(self, instance, *args, **kwargs):

# Don't count page aliases as existing translations. We can convert aliases into properly translated pages
if isinstance(instance, Page):
existing_translations = existing_translations.exclude(
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion: pre-commit install && pre-commit run black --all-files

@kaedroho kaedroho marked this pull request as ready for review March 28, 2022 15:06
Copy link
Collaborator

@zerolab zerolab left a comment

Choose a reason for hiding this comment

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

Did a cursory review. Got a few comments. Will aim to do a full review later.

Needs tests for the queue changes

wagtail_localize/operations.py Show resolved Hide resolved
docs/how-to/configure-background-tasks.md Show resolved Hide resolved
docs/how-to/configure-background-tasks.md Show resolved Hide resolved
docs/how-to/configure-background-tasks.md Outdated Show resolved Hide resolved
@chris48s
Copy link
Collaborator

chris48s commented Apr 6, 2022

I had a quick read over this. This is a cool feature 🎉 No specific comments on the code, but I think you can backport ParamSpec to Python <= 3.10 by adding https://pypi.org/project/typing-extensions/ to the requirements (not tested).

@zerolab
Copy link
Collaborator

zerolab commented May 3, 2022

@kaedroho conflicting test app migrations.
May I suggest dropping all test app migrations, and generating a single initial one?

@kaedroho
Copy link
Contributor Author

kaedroho commented May 6, 2022

Rebased and test app migrations regenerated

@zerolab
Copy link
Collaborator

zerolab commented May 6, 2022

@kaedroho drop the 0066_collection_management_permissions reference in the initial migration. That should solve the test failures. Then we can merge

@zerolab zerolab merged commit f4789e3 into wagtail:main May 6, 2022
@zerolab
Copy link
Collaborator

zerolab commented May 6, 2022

Fixed the test_schema_is_out_of_date_if_source_schema_version_is_old test and merged manually. Thank you @kaedroho

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