Repository navigation
Feat: registry (backends / transports / schedulers) - #28
Draft
Alexander-Auer wants to merge 34 commits into
Draft
Alexander-Auer wants to merge 34 commits into
Alexander-Auer wants to merge 34 commits into
Conversation
… have them link to each other
…ede into feat/core-contract
…a consumer should choose to use it or not
* feat: Models the core contract needs * Feat: Protocols and Exceptions added for the core contract * Feat: Private protocols for the BatchBackend * feat: a fake backend to run unit tests against * fix: some code cleanup in the helper functions * feat: setup for the unit test suite * chore: style fix * chore: styling, unit test fixture * chore: single letter var `h` refering to hanlde changed to `handle` * fix: unused parameter in `test_injected_failure_is_reported_per_job()` removed * feat: Models the core contract needs * Feat: Protocols and Exceptions added for the core contract * Feat: Private protocols for the BatchBackend * feat: a fake backend to run unit tests against * fix: some code cleanup in the helper functions * feat: setup for the unit test suite * chore: style fix * chore: styling, unit test fixture * chore: single letter var `h` refering to hanlde changed to `handle` * fix: unused parameter in `test_injected_failure_is_reported_per_job()` removed * fix: made the OutputSpec optional as it is not suppoerted by all and a consumer should choose to use it or not --------- Co-authored-by: alexander <alexander.auer@cern.ch>
…d of a hash of the full object
Add BackendConfig, one flat public model a consumer uses to describe any backend (kind, transport, scheduler, endpoint, host, ...). It is resolved internally into the settings of exactly one backend family, so a field that does not apply to the chosen kind is refused by name instead of ignored. Add the registry: registry.backend(config) builds the backend a configuration describes, from closed name -> "module:Class" tables. Entries are imported lazily and every built object is checked against its protocol, so a broken entry fails at resolution with a RegistryError. Part of DIRACGrid#18. Co-authored-by: alexander <alexander.auer@cern.ch>
Alexander-Auer
marked this pull request as ready for review
October 20, 2026 14:53
Alexander-Auer
marked this pull request as draft
October 20, 2026 14:53
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: backend configuration and a closed registry
Part of #18.
Important
Depends on #27. Merge after #27 (PR 2 of 4; the full order is listed in #27).
Until #27 is merged, this diff also shows the earlier PRs. This PR's own change is one commit:
f90cdd4A consumer can now say which backend it wants as plain data, and get a backend for it:
Configuration: one flat public model
BackendConfigis the only public configuration class. The consumer uses the same field names for every backend, and never needs to know which classes interCEde uses inside:kindarc,htcondor-ceendpoint,auth(token,proxy)cloudendpoint,driver,vm_image,vm_flavor,driver_options,vm_networks,vm_ssh_key,vm_max_lifetime_sbatch+localschedulerbatch+sshscheduler,host,user,known_hosts,port,jump_host,connect_timeout_s,auth(key,passwordoragent)cloudqueue,container_launcher,max_output_bytes,max_output_files,transfer_timeout_sThe three backend families of IC-ADR-001 §4 are covered:
arc,htcondor-cecloudbatch, a transport combined with a schedulerHow it is checked. Internally,
resolve()turns the flat model into the settings of exactly one backend (_backends/config.py), and the model calls it while it is being built. So mistakes are reported immediately, in the consumer's own field names:Rules:
driver_optionsadditionally refuses secret-looking keys.known_hosts, because host key verification is not optional.container_launchermust contain an{image}placeholder.Registry: closed, lazy, checked
_BACKENDS,_TRANSPORTSand_SCHEDULERSmap a name to"module:Class"and live in interCEde itself, as dictionaries rather than entry points, so nothing outside the library can add to them (IC-ADR-001 Rejected Ideas).import intercedeimports no backend.from_settings(...). The registry builds the object and checks it withisinstanceagainstJobBackend,TransportorScheduler. A missing module, a missing class, a missingfrom_settings, or an object that breaks its protocol is reported as aRegistryErrorat resolution, never at the first call.batch, the transport is built from its own settings and the scheduler from the batch settings, then both are passed to the batch backend. Sossh+slurmandlocal+slurmshare one class.registry.available()lists what a configuration can ask for in this version, for tooling.Errors.
ConfigurationErrormeans the configuration is invalid. The newRegistryErrormeans the configuration is valid, but this version does not ship what it asks for, or an entry is broken.The tables currently contain only the internal fake, which the conformance suite now builds through the registry. Each real backend from issues #19 to #23 adds one line plus a
from_settings. Until then, valid real configurations correctly report, for example,backend 'arc' is not available in this version of interCEde.Differences from issue #18 and the ADR
{"kind": "batch", "transport": "ssh", "scheduler": "slurm", "host": ...}) and keeps the per-family settings internal.lsf,sge,oarandtorqueare left out for now. Adding a kind later is non-breaking.Tests
tests/unit/test_config.py: every family, required and refused fields, auth values, limits, and the error messagestests/unit/test_registry.py: resolution per family, composition, broken entries, caching,available(), lazy imports, and that calls on the returned object reach the registered classtests/unit/_registry_dummies.py: stand-in classes the tests register163 tests pass on Python 3.11 and 3.13, and pre-commit, including strict mypy, passes.