generic.routing.random
Routes requests to the candidate backends in random order, so that they spread over all backends without round-robin state. The successor of proTES's random task distribution.
| Plugin ID | generic.routing.random |
| Distribution | foca-plugin-generic-routing-random |
| Import path | foca_plugins.generic.routing.random |
| APIs | all (*) |
| Phases | route |
| Maturity | experimental |
| Data transfers | none |
| Data stored | none (no plugin store) |
| FOCA | 0.18, 0.19, 0.20 (>=0.18.0,<0.21) |
What it does
route: returns all candidate backends, shuffled with the operating system's randomness (random.SystemRandom). It drops no candidate and adds none; the gateway then tries them in that order. It records the annotationscandidates(their number) andseeded(whether a seed was used).
It never rejects a request and never raises NotApplicable. The order
itself is in the provenance of each request (route.candidates_out), so
the plugin doesn't record it again.
FOCA's default router, foca.routing.ordered, keeps the order of the
backend list and shuffles only the backends of each service registry among
themselves. This plugin shuffles all candidates, configured or discovered.
Configuration
Admin settings, in the gateway app's configuration (FOCA's plugins
section):
plugins:
available:
generic.routing.random:
distribution: foca-plugin-generic-routing-random
config:
allow_seed: false # default; true only for tests
pipeline:
- id: route
alternatives:
- plugin: generic.routing.random
| Setting | Type | Default | Description |
|---|---|---|---|
config.allow_seed |
boolean | false |
whether pipelines may set seed |
params.seed |
integer or null |
null |
seed of the shuffling, for reproducible orders in tests; refused (when pipelines are resolved) unless allow_seed is set |
With a seed, the order is a function of the seed and the candidate list,
on the same Python version (Python doesn't promise the same shuffles
across versions). Seeded orders are predictable, also for clients that
choose the plugin in their own pipelines: keep allow_seed off in
production. A test setup:
plugins:
available:
generic.routing.random:
config:
allow_seed: true # tests only
pipeline:
- id: route
alternatives:
- plugin: generic.routing.random
params:
seed: 42
proTES's old default
proTES used to try distance-based routing first and fall back to random
routing. The same pipeline with plugins, once distance routing
(tes.routing.distance)
is released:
plugins:
pipeline:
- id: route
alternatives:
- plugin: tes.routing.distance
- plugin: generic.routing.random
Installation
pip install foca-plugin-generic-routing-random
See "Installing" in the docs for release trains and derived images.
Development
From the repository root, with the development environment set up (see "Contributing" in the docs):
uv run ruff check plugins/generic/routing/random
uv run python -m scripts.packages mypy plugins/generic/routing/random
uv run coverage run --source plugins/generic/routing/random/src \
-m pytest plugins/generic/routing/random
uv run coverage report
Changelog
See CHANGELOG.md.
Metadata
Release files for foca-plugin-generic-routing-random 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| foca_plugin_generic_routing_random-0.1.2.tar.gz | 12.1 kB | With provenance | Details for foca_plugin_generic_routing_random-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| foca_plugin_generic_routing_random-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for foca_plugin_generic_routing_random-0.1.2-py3-none-any.whl |
Total release size: 21.9 kB
Release files / foca_plugin_generic_routing_random-0.1.2.tar.gz
| Download URL | foca_plugin_generic_routing_random-0.1.2.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b76e06a8c883b06584775696015cad9e33ebf516f5438f7b0c6de05262139ba
|
|
BLAKE2b-256 checksum How to use checksums |
3321eedb2af8736ba80518403b75a1a2d566e9bedd3eb08c20b88d314d14b54b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logRelease files / foca_plugin_generic_routing_random-0.1.2-py3-none-any.whl
| Download URL | foca_plugin_generic_routing_random-0.1.2-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a86b4dd2ad8f495ac3eb67e03773ee3081fc6425661da852083883821098f79
|
|
BLAKE2b-256 checksum How to use checksums |
80681d9c287f8ecd3692805d8231bd008d51172594dc203f6f900e97179df802
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logSecurity for foca-plugin-generic-routing-random 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for foca_plugin_generic_routing_random-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.