Skip to content

Route test tasks to per-package queues and split Docker release builds - #244

Merged
anfimovdm merged 1 commit into
clfrom
al-alts-reserved-docker-queues
Nov 5, 2026
Merged

anfimovdm merged 1 commit into
clfrom
al-alts-reserved-docker-queues

Conversation

@anfimovdm

@anfimovdm anfimovdm commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A new package_queue_suffixes scheduler option maps package name regexes to queue suffixes, so test tasks of those packages go to their own <runner>-<arch>-<suffix> queue and can be served by dedicated workers. The option is empty by default, so nothing changes until it is set. Docker release builds also get their own queue, the same way OpenNebula already handles them.

Task Docker OpenNebula
Regular docker-<arch>-0 (unchanged) opennebula-<arch>-1 (unchanged)
Release build docker-<arch>-1 (new) opennebula-<arch>-2 (unchanged)
Package matching a package_queue_suffixes regex, any build docker-<arch>-<suffix> (new) opennebula-<arch>-<suffix> (new)

Example scheduler.yaml:

package_queue_suffixes:
  "acme-foo.*": "foo"     # -> docker-x86_64-foo, opennebula-x86_64-foo
  "acme-.*": "acme"

Changes

  • alts/scheduler/scheduling.py: new get_package_queue_suffix() returns the suffix of the first regex that matches the whole package name (re.fullmatch, case-sensitive). New get_queue_suffix() uses it, falling back to the runner's get_cost(release_build).
  • alts/shared/models.py: new SchedulerConfig.package_queue_suffixes: Dict[str, str] = {}. A validator rejects invalid regexes and empty suffixes when the config loads.
  • alts/worker/runners/docker.py: DockerRunner gets COST_STANDARD = 0, COST_RELEASE_BUILD = 1 and a get_cost() built the same way as OpennebulaRunner's.
  • tests/scheduler/test_scheduling.py: tests for the queue names and the config validation.

Notes

  • Only the scheduler calls get_cost, so only the scheduler needs redeploying.
  • Package queues aren't declared in alts/worker/app.py. Celery creates them the first time a task is sent there (task_create_missing_queues is on by default), with the same x-max-priority argument. A test checks this.
  • Priorities work the same inside every queue, including the package ones (Redis broker).
  • Entries are checked in order, so put more specific regexes first.
  • Don't use a number as a suffix: 0-4 are the runners' cost queues.
  • Workers need new queues before or together with this deploy, or tasks will pile up unprocessed:
    • docker-<arch>-1 on at least one Docker node per architecture, for release builds;
    • for each configured suffix, docker-<arch>-<suffix> / opennebula-<arch>-<suffix> on the nodes set aside for those packages.

Testing

  • CELERY_CONFIG_PATH=tests/tests_config.yaml SCHEDULER_CONFIG_PATH=tests/tests_config.yaml pytest tests/ --deselect tests/executors: 100 passed, 6 skipped. The executor tests need a local SSH server (CI runs one in the container), so they were left out locally.
  • The new tests cover:
    • with acme-foo.*, acme-bar[0-9]+(-.*)? and a catch-all acme-.*, each package goes to its own suffix queue for both runners, release or not, and the first matching entry wins;
    • names the regex only partly matches (my-acme-foo1), different case (ACME-FOO1) and unrelated packages keep their cost queues;
    • with the default empty dict, a package keeps its cost queue;
    • an invalid regex or an empty suffix fails config validation;
    • regular vs release queues for both runners;
    • an undeclared package queue still gets the x-max-priority argument.
  • Celery and the scheduler DB are mocked; no real broker, Docker or OpenNebula run.

🤖 Generated with Claude Code

@anfimovdm anfimovdm changed the title Route alt-php test tasks to reserved queues and split Docker release builds Route reserved packages' test tasks to reserved queues and split Docker release builds Nov 5, 2026
@anfimovdm anfimovdm changed the title Route reserved packages' test tasks to reserved queues and split Docker release builds Route test tasks to per-package queues and split Docker release builds Nov 5, 2026
New package_queue_suffixes scheduler option maps a package name regex
to a queue suffix, e.g. {'acme-.*': 'acme'} sends matching test tasks
to <runner>-<arch>-acme, so dedicated workers can serve them. The regex
must match the whole name and the first matching entry wins. It is
empty by default. Docker release builds now get their own
docker-<arch>-1 queue, like OpenNebula already does with
opennebula-<arch>-2.
@anfimovdm
anfimovdm force-pushed the al-alts-reserved-docker-queues branch from 4c6e0e2 to c7d537a Compare November 5, 2026 21:31
@anfimovdm
anfimovdm merged commit eb023ed into cl Nov 5, 2026
2 checks passed
@anfimovdm
anfimovdm deleted the al-alts-reserved-docker-queues branch November 5, 2026 21:35
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.

1 participant