Introduce an official, non-Celery-managed reviewbot command.

Review Request #12097 — Created March 1, 2022 and submitted — Latest diff uploaded

chipx86
ReviewBot
release-3.0.x
reviewbot

Celery generally likes to own the world. Rather than just being a useful
library for talking to queues, it also wants to be the command
management tool, even taking over version and help information.

This is generally not a great experience. We end up exposing a bunch of
commands and options that aren't needed for Review Bot. We've wanted to
drop this for a long time. This change does that.

Now, we have a simple reviewbot command line tool that takes a handful
of vetted options. Most of these are Celery options, but only ones that
we want to pass on to Celery. It's otherwise under our control, and we
can build upon this in the future to take new options.

Once invoked, we set up a Celery instance, and a Worker command instance
(which is what powered the reviewbot command in the past). We treat
this somewhat like a utility API, calling the methods we need to set up
the right state.

There is a trade-off here. If Celery makes substantial changes to the
internals, we'll have to update a couple things. That's not a big deal,
though, as most of what we're bypassing is the argument parsing and
initial environment setup. Once we've tackled this ourselves, we just
call run() on the worker command.

The one annoying complication is the --detach argument. Normally,
Celery handles this completely for us, but not really if being invoked
programmatically. Which is sort of okay. When it detaches, it hard-codes
celery worker ..., which isn't what we wanted anyway.

The old reviewbot worker invocation is still supported, but emits a
deprecation message. We can remove this in future release.

Tested all options on Python 2 and 3, and verified that they invoked the
right behavior in Celery.

Commits

Files

Loading...