Repository navigation
Feat: Core contract (Models, Protocols, exceptions) issue #16 - #27
Open
Alexander-Auer wants to merge 33 commits into
Open
Alexander-Auer wants to merge 33 commits into
Alexander-Auer wants to merge 33 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>
Alexander-Auer
marked this pull request as draft
October 9, 2026 11:33
added 2 commits
October 9, 2026 16:13
…d of a hash of the full object
Alexander-Auer
marked this pull request as ready for review
October 19, 2026 07:00
This was referenced Oct 20, 2026
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: core contract (protocols, data types, typed errors)
Closes #16.
Note
Merge order. This PR is the first of four. Each later PR builds on the one before it and should be merged only after it:
Implements the Tier-A contract of IC-ADR-001: the protocols, data types and exceptions, with an in-memory
FakeBackendand a unit conformance suite. There are no real backends and no registry yet.What's included
Public API (
intercede, exported via__all__)@runtime_checkable):Submitter,StatusReporter→JobBackend(an async context manager)OutputRetriever,Killable,Purgeable,Diagnosableextra="forbid"):SubmissionSpec,CopyVars,FileRef,OutputSpec,OutputMember,ContainerSpec,Resources,Submission,JobHandle,JobID,JobStatus,StatusMap,JobOutput,Diagnostics,OpOutcomeInterCEdeError→ConfigurationError,AuthenticationError,ResourceUnavailableError,SpecificationRejectedErrorInternal (
intercede._backends)batch/protocols.py: the shapes ofTransportandScheduler, with no implementationsfake.py:FakeBackend, implementing every capability, with hooks for tests. mypy checks that it conforms to each protocol.Package hygiene
py.typed, and strict mypy with the pydantic plugin (runs in CI through pre-commit)pydantic>=2as the only runtime dependencypixi run -e docs docsContract rules enforced
submit()reads local inputs before it returns and never keeps caller paths.OpOutcome(ok=False, reason=...), and unknown jobs come back asUNKNOWN, never dropped.SpecificationRejectedError.dest.CopyVars.secretsusesSecretBytes, so it never appears inrepr, logs or JSON.SubmissionSpec.outputsis optional, because not every backend can retrieve output and a consumer should only ask for it when it needs it.Deviations from the ADR (feedback welcome)
JobHandle, notJobID. A job ID is only unique within one resource, so keying by ID would let job1234on two clusters overwrite each other. Handles are hashable through a key built from backend, resource and id, with:escaped inside each part.Submission.handlesis aMapping[int, JobHandle]keyed by copy index. With a list, one refused copy shifts every later handle. With a map,handles[i]always belongs tocopies[i].OpOutcome[T]is generic and carries avalue. This letsget_outputandget_diagnosticsreport per-job failures too.killandpurgeuseOpOutcome[None], and a validator keepsok,valueandreasonconsistent.Schedulergainsparse_submit(raw),parse_status(raw, ids)and aworkdir, which the composed backend needs.Transportgains the lifecycle methods.If these are accepted, IC-ADR-001 should be updated to match.
Deliberately left out
LoadReporter/JobCountsand thedestructiveretrieval flag. Issue [Feature]: Core contract (protocols, data types, typed errors) #16 lists them, but the current ADR drops them. Public API can be added later without breaking anyone; removing it cannot._htcondorcore #23.Tests
tests/unit/test_models.py: validation rules (hashing, secrets, name checks, theOpOutcomeandSubmissioninvariants)tests/unit/test_protocols.py:isinstancenarrowing per capabilitytests/unit/test_conformance.py: contract tests that use only the public API, through abackendfixture that honoursbackend_onlyandxfail_backend, so they can be reused against real backendstests/unit/test_fake_backend.py: partial failure, refusal, path containment, repeatable outputAll tests run against
FakeBackend; no real scheduler or CE is involved.How to check