Update Review Bot 3 to use Celery 5 on Python 3.

Review Request #12157 — Created March 16, 2022 and submitted — Latest diff uploaded

Information

ReviewBot
release-3.0.x

Reviewers

Review Bot 2 was using Celery 4, which is no longer maintained, and
Review Bot 3 inherited that dependency. Between Celery 4 (which is no
longer maintained and has security problems) and 5, much has changed
when it comes to the celery worker command setup and invocation, and
this is what we were wrapping in order to start a process. This is no
longer feasible.

Now, we construct the Worker object ourselves. This is more
future-proof, though comes with a few requirements on our end (some
patching functions we have to call, and some arguments to process).

We now support setting up both Celery 3 (on Python 2.7) and Celery 5 (on
Python 3). This code is confined to celery.py, allowing main.py to
be nice and simple. In time, this will also help us upgrade to newer
versions of Celery or to switch to another backend (perhaps
experimentally).

Tested running on Python 2.7 and 3.x in both detached and in-process
modes, with various combinations of options.

Unit tests pass.

Commits

Files