Platform contracts and clients
Armada uses shared Protocol Buffers contracts to connect job submitters, service users, executors, and event consumers. The contracts define the job model, request and reply shapes, state changes, executor control, and links to jobs in external systems. Generated language clients give users a safer way to call these services without building the wire layer themselves.
Integration model
Armada presents one contract surface with several roles. Users and services submit and control jobs through the public API. Executors use a separate scheduling contract to receive work and report run events. Event consumers read state changes from a job-set stream or from the internal event log. Operational tools also use contracts for executor, node, log, health, and scheduling-report views.
The main identity keys are the queue and job set. A queue provides the scheduling and access scope. A job set groups jobs for submission, control, and observation. A job ID identifies one job, while a job run ID identifies one attempt to run that job.
flowchart LR
U[Users and services] -->|submit, query, cancel, preempt| A[Armada API contracts]
A --> Q[Queued jobs and job sets]
Q -->|leases and control| E[Executors]
E -->|run events and usage| A
A -->|job-set event stream| C[Event consumers]
A -->|generated bindings| L[Language clients]
L --> U
O[Operators and tools] -->|health, logs, reports, node control| A
The public API and the executor API share the same job concepts but serve different trust and control boundaries. A client can submit a job without acting as an executor. An executor must report cluster capacity and run state so that Armada can place work and keep job state current. For the user-facing job flow, see Submission and queue management. For the executor side, see Executor runtime.
References: pkg/…/submit.proto• L14-32 pkg/…/job.proto• L22-50 pkg/…/executorapi.proto• L54-72 pkg/…/binoculars.pb.go• L314-320
Contract families
The contracts group operations by the part of the Armada lifecycle they serve. Each family has a clear input and output role.
| Contract family | Purpose | Main consumers |
|---|---|---|
| Submission and queue | Create and manage jobs, job sets, queues, and retry policies | Users, services, operators |
| Job query | Read job state, run details, errors, and active queues | Users, services, dashboards |
| Job events | Stream job-set state changes with ordered message IDs | Event consumers, clients |
| Executor control | Exchange capacity, leases, cancellations, and preemptions | Executors and scheduler |
| Operational control and reporting | Control executors and nodes, inspect logs and scheduling reports, and check service health | Operators, control services, dashboards |
| Internal event records | Carry state transitions and run data through the event log | Armada services and event processors |
Submission and queue contracts
The submission contracts turn a batch request into Armada jobs and carry the Kubernetes pod work used for scheduling. A request names one queue and one job set, then supplies one or more job items. Each item describes Kubernetes pod work plus Armada metadata such as priority, labels, services, an optional scheduler, and an optional external job URI. Armada keeps that URI with the job so an outside system can find the job later. Pod-level resource requirements remain part of the submitted specification, and the scheduling view accounts for the complete pod shape. The reply gives each item a job ID or an item-level error.
The same public service also supports job control and queue management. Clients can cancel, preempt, or reprioritise jobs. They can create, update, list, cordon, and delete queues. Retry policy operations provide a named policy resource that queues can use. A policy can decide whether a failure is retried and can change placement or memory for the retry.
References: pkg/…/submit.proto• L14-32 pkg/…/submit.proto• L60-109 pkg/…/submit.proto• L242-308 pkg/…/submit.proto• L395-510 pkg/…/submit.pb.go• L164-180 pkg/…/submit.pb.go• L768-812 pkg/…/util.go• L36-79 pkg/…/util_test.go• L417-441
Job query contracts
The query contracts provide read views of jobs and runs rather than a second state model. A job view reports the job-level state and identity. An expanded view can include the submitted specification and its job runs. A run view reports the attempt state, placement data, and the executor-reported pod name when one exists. The HTTP contract exposes this pod name in the run details response and leaves it empty before a run has a pod.
Consumers can query by job ID, run ID, or an external job URI tied to a queue and job set. The external URI comes from the submission field when present, or from the supported job annotation when it is not. This lets a service keep its own job record while using Armada as the source for scheduling and run status.
References: pkg/…/job.proto• L9-100 pkg/…/job.proto• L102-139 pkg/…/job.pb.go• L32-92 pkg/…/job.pb.go• L197-211 pkg/…/job.pb.go• L1029-1039 pkg/…/submit.proto• L29-31 pkg/…/submit.proto• L149-155 pkg/…/api.swagger.json• L365-397 pkg/…/api.swagger.json• L1775-1819 pkg/…/api.swagger.go• L376-407 pkg/…/api.swagger.go• L1802-1819
Event stream contracts
The event service turns job state changes into a stream for one queue and job set. Each stream item has a message ID and one event message. Consumers can start from a message ID, which supports recovery after a disconnect without treating the stream as a fresh watch. The current stream contract is GetJobSetEvents; the older Watch RPC remains available but is deprecated.
The event model covers submission, queueing, leasing, pending and running states, completion, failure, cancellation, preemption, reprioritisation, utilisation, and ingress information. A failed event can be marked as retryable. Consumers must therefore distinguish an intermediate failed run from a terminal job outcome. Pod number fields are retained for compatibility but are deprecated because the executor creates one pod for each run. Consumers that need the pod identity should use pod_name.
The internal event sequence now also carries validation, requeue, per-run cancellation, and diagnostic teardown records. A diagnostic teardown record carries JSON debug data for Lookout and does not change run state. Error records can carry a failure category, an optional subcategory, and the retry policy name that chose retry or terminal failure. These records are internal event-log inputs rather than a replacement for the public job-set stream.
For a detailed view of message types and event meaning, see Protobuf APIs and events. For storage and replay context, see Event ingestion and history.
References: pkg/…/event.proto• L14-20 pkg/…/event.proto• L102-127 pkg/…/event.proto• L219-255 pkg/…/event.proto• L273-305 pkg/…/event.pb.go• L844-868 pkg/…/event.pb.go• L1820-1936 pkg/…/event.pb.go• L2680-2787 pkg/…/events.proto• L66-110 pkg/…/events.proto• L466-525 pkg/…/events.proto• L630-680 pkg/…/events.pb.go• L92-106 pkg/…/events.pb.go• L177-205
Executor contracts
The executor contract connects Armada's scheduler to a Kubernetes cluster adapter. An executor sends a lease request stream with its identity, pool, resource view, node data, and current unassigned runs. Armada answers on the same stream with job leases and requests to cancel or preempt runs.
The executor also reports run events in batches. This split makes the contract a two-way work exchange: capacity and current placement move toward the scheduler, while assignments and control decisions move toward the executor.
References: pkg/…/executorapi.proto• L13-37 pkg/…/executorapi.proto• L50-103 pkg/…/executorapi.proto• L106-116
Operational control and reporting contracts
Operational contracts let trusted tools change execution scope and inspect the scheduler without submitting jobs. Executor actions can update or remove executor settings, cancel or preempt jobs by executor, and filter those actions by queue, priority class, or pool. Node actions apply the same kind of control to a named node and can also name its executor.
The same surface exposes focused views for day-to-day operation. Log calls return lines for a job pod identified by its reported pod name and namespace, while health reports whether a service is serving and scheduler reports can be requested for an executor, queue, or job with a chosen verbosity. The older pod number remains for compatibility but is deprecated because each run has one pod. These interfaces support control and diagnosis; they do not replace the job and run state contracts.
References: pkg/…/executor.pb.go• L32-36 pkg/…/executor.pb.go• L180-187 pkg/…/executor.pb.go• L250-257 pkg/…/executor.pb.go• L377-386 pkg/…/node.pb.go• L32-38 pkg/…/node.pb.go• L101-107 pkg/…/node.pb.go• L214-220 pkg/…/binoculars.pb.go• L33-40 pkg/…/binoculars.pb.go• L314-320 pkg/…/health.pb.go• L26-55 pkg/…/scheduler_reporting.pb.go• L121-127 pkg/…/scheduler_reporting.pb.go• L506-516
Internal event contracts
Armada's internal event contract records state transitions as event sequences. The sequence carries the queue, job set, user context, and a group of transitions. It is the durable event shape used inside Armada, while the public event service exposes a client-facing job event shape.
The event set also carries validation, requeue, per-run cancellation, and diagnostic teardown records. A diagnostic teardown record carries JSON debug data for Lookout and does not change run state. Error records can carry a failure category, an optional subcategory, and the retry policy name that chose retry or terminal failure.
The internal model separates a job from a job run. A job is the requested application and may have more than one run. A run is one attempt on an executor. This distinction lets Armada retry or re-lease work without changing the identity of the submitted job.
References: pkg/…/events.proto• L12-62 pkg/…/events.proto• L64-109 pkg/…/events.proto• L466-525 pkg/…/events.proto• L630-680
Language clients
Language clients wrap the generated gRPC bindings with a small user-facing API. They let an application build a submission request, call Armada, and consume job events in its own language while keeping the shared protobuf types as the compatibility point.
The repository provides clients for Python, Rust, Java, Scala, and .NET. It also generates Go gRPC bindings for the API services. These clients do not define separate business models. They map language-native calls to the same submission, query, queue, and event services, with some clients offering a smaller feature set than the full contract surface.
For client-specific capabilities and usage, see Client SDKs.
Client responsibilities
Clients typically handle the boundary work that should not be repeated in each user service:
- create gRPC service stubs from one channel;
- build protobuf request messages for submission and control actions;
- provide language-native builders or types for Kubernetes-backed job specs;
- expose job and run queries through simple methods;
- turn the event RPC into an iterable or asynchronous stream;
- attach caller authentication and apply connection or call deadlines.
The client does not replace Armada's scheduler. It submits intent and reads results. Armada remains responsible for queue order, lease decisions, executor placement, run state, and terminal job state.
References: client/…/client.py• L93-150 client/…/lib.rs• L1-72 client/…/client.rs• L16-25 pkg/…/job.pb.go• L1029-1039 pkg/…/executor.pb.go• L377-386
Client and transport boundary
The contracts support gRPC as the native transport and expose HTTP mappings for many public operations. This allows service-to-service callers to use generated gRPC stubs while simpler integrations can use the mapped REST endpoints. Both paths use the same protobuf request and response definitions.
Authentication is supplied at the transport boundary rather than encoded in job messages. Client libraries can pass bearer or other credentials through the channel or call metadata. TLS and call deadlines are also client concerns because they protect the connection and bound the time spent waiting for a response or stream.
References: pkg/…/submit.proto• L409-510 pkg/…/event.proto• L294-305 pkg/…/job.proto• L102-139 pkg/…/api.swagger.json• L117-171 client/…/client.rs• L86-170
Job and event lifecycle
The contracts describe one job lifecycle from user intent to executor result. The public request creates the job identity. The scheduler then moves work through the queue and lease boundary. The executor reports run progress, and the event service makes the resulting state visible to consumers.
When a service processes a job, the shared contract flow is:
- Submit one or more job items to a queue and job set.
- Store the returned job IDs with the caller's own business record.
- Watch the job-set event stream or query job status.
- Treat lease and run events as progress, not as final job results.
- Use the terminal job event or query result to complete the caller's workflow.
The relationship between job state and run state matters for retries. A job can return to a pending state after a recoverable run failure. A consumer that stops at the first failed run can report a false terminal failure.
References: pkg/…/events.proto• L25-62 pkg/…/event.proto• L102-127 pkg/…/event.proto• L234-254 pkg/…/event.pb.go• L844-868 pkg/…/job.proto• L22-50
Contract evolution
Protocol Buffers provide the shared schema boundary across Armada services and language clients. Generated code is derived from the .proto definitions, so a contract change reaches server stubs, client bindings, executor code, and event consumers through regeneration. The generated Go files identify their source schema and expose the current message and gRPC service view for Go callers. The generated Swagger JSON and Go template expose the HTTP view of the public contracts, including external job URI submission and lookup, retry policy shapes, the job-run podName field, and the event and log fields used to identify a pod.
The schemas preserve compatibility by reserving removed field numbers and by marking older fields or RPCs as deprecated when a replacement exists. Consumers should read the current field and oneof choices while remaining tolerant of unknown fields. Event consumers should use message IDs and explicit state semantics rather than relying on the order of local processing alone. In event pod data, use pod_name instead of the deprecated pod_number field.
The internal event schema changed in this refresh to expose validation, requeue, per-run cancellation, and diagnostic teardown events in the generated Go bindings. JobRunTerminatedDebugInfo is diagnostic data only. It does not represent an error or change run state.
References: pkg/…/submit.proto• L14-32 pkg/…/submit.proto• L242-308 pkg/…/submit.proto• L413-441 pkg/…/submit.pb.go• L164-180 pkg/…/api.swagger.json• L365-397 pkg/…/api.swagger.json• L1991-2040 pkg/…/api.swagger.go• L376-407 pkg/…/api.swagger.go• L2002-2049 pkg/…/event.proto• L38-49 pkg/…/event.proto• L58-70 pkg/…/event.proto• L102-127 pkg/…/event.proto• L219-255 pkg/…/event.proto• L294-305 pkg/…/event.pb.go• L296-307 pkg/…/event.pb.go• L844-868 pkg/…/events.proto• L66-110 pkg/…/events.proto• L654-680 pkg/…/events.pb.go• L177-205 pkg/…/events.pb.go• L513-524
Change checklist
When these files or sections are changed, remember to consider these:
- A change to pkg/…/submit.proto can affect gRPC methods, REST mappings, generated clients, and any code that builds queue, job, external-URI, or retry-policy requests.
- Changes to external job URI fields must keep submission, annotation fallback, stored job data, and
GetJobStatusUsingExternalJobUrilookup semantics aligned. - Changes to retry policy mutations must preserve the meaning of retry decisions and the placement or resource changes applied to retried jobs.
- A change to pkg/…/event.proto must be checked against stream resumption by message ID, deprecated
Watchcallers, and consumers that map failed events to terminal status. - Changes to event pod identity must keep
pod_nameas the usable identity and must not restore reliance onpod_number, which is always zero for the executor's one-pod-per-run model. - A change to pkg/…/executorapi.proto must preserve the two-way lease stream between the scheduler and every executor implementation.
- A change to job-run or log pod identity must be checked across pkg/…/job.proto, pkg/…/binoculars.proto, the generated Go bindings, and both public Swagger descriptions. Keep
pod_nameas the usable identity and retain deprecatedpod_numberonly for compatibility. - A change to Kubernetes types embedded in job messages must be regenerated and reviewed in each language client that exposes pod specs. Preserve pod-level resource requirements through protobuf encoding and keep scheduling demand aligned with container and init-container behavior.
- A change to internal event records in pkg/…/events.proto must be checked against event producers, processors, and any conversion to public job events.
- Changes to executor, node, log, health, or scheduler-report contracts must be checked against the operational tools that use their generated service stubs.
- Consumers of internal event records must treat
JobRunTerminatedDebugInfoas diagnostic data rather than a state change. They must also preserve the meaning of failure classification and retry-policy metadata. - Regeneration must keep pkg/…/submit.pb.go, pkg/…/api.swagger.json, and pkg/…/api.swagger.go aligned with pkg/…/submit.proto.
- Regeneration must keep pkg/…/event.pb.go, pkg/…/api.swagger.json, and pkg/…/api.swagger.go aligned with pkg/…/event.proto.
- Regeneration of pkg/…/events.pb.go must keep the internal event oneof list aligned with pkg/…/events.proto, including diagnostic teardown events that do not change run state.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
Consumer treats the first JobFailedEvent as terminal | A retryable run failure appears as a failed job | Check the retryable flag and confirm the job's terminal state |
Consumer uses pod_number to identify an event's pod | Different runs cannot be told apart because the value is always zero | Use pod_name and the run identity |
| Submission and lookup use different external job URI values | A service cannot find the Armada job that belongs to its own record | Send one stable URI and keep the submission fallback and status lookup scope aligned |
Consumer continues to call the deprecated Watch RPC as the only event path | The integration stays on the old contract and can miss newer stream behavior | Use GetJobSetEvents with its message-ID resume point |
| Event watcher reconnects without its last message ID | A service can miss events or process a full job set again | Persist and send the latest stream message ID when reconnecting |
| Client sends a request with the wrong queue or job set | Queries and control actions target no jobs or the wrong scope | Keep queue and job-set identity with the submitted job record |
| Pod-level resource requirements are lost during contract encoding | Scheduling can use a smaller resource view than the submitted workload needs | Preserve pod-level resources through the protobuf round trip and include them in scheduling demand |
| Executor stops sending lease requests or run events | Armada cannot assign work or trust the executor's view of runs | Keep the lease stream and event reporting path alive |
| An operational caller uses a broad executor or node filter | Cancel or preempt actions affect more work than intended | Set the executor or node identity and all required queue, priority-class, and pool filters |
| Protobuf fields change without regenerating bindings and HTTP descriptions | A client, service, or REST integration cannot encode, decode, or expose the updated contract | Regenerate all affected language bindings and Swagger artifacts from the schema change |
Consumer treats JobRunTerminatedDebugInfo as a failure event | Diagnostic teardown data can incorrectly move a run to an error state | Store it as debug data and leave the run state unchanged |
| Internal event oneof bindings are stale after a schema change | Producers or consumers cannot publish or decode the new event type | Regenerate events.pb.go and verify the generated oneof wrappers match events.proto |
Key files
| File | Why to read it |
|---|---|
| pkg/…/submit.proto | Defines the main public job, queue, retry policy, external job URI, and control contracts. |
| pkg/…/submit.pb.go | Shows the generated Go messages and service boundary for submission, queue, retry policy, and external job URI operations. |
| pkg/…/util.go | Defines shared API conversions for job state, event identity, and pod resource demand. |
| pkg/…/job.proto | Defines the read model for job and run status, including executor-reported pod identity. |
| pkg/…/job.pb.go | Shows the generated job and run query messages used by Go callers. |
| pkg/…/event.proto | Defines the public job-set event stream, event types, resume point, deprecated watcher, and pod identity fields. |
| pkg/…/event.pb.go | Shows the generated event messages and gRPC client/server boundary. |
| pkg/…/api.swagger.json | Shows the generated HTTP contract and public schemas, including external job URI lookup and submission. |
| pkg/…/executorapi.proto | Shows how schedulers and executors exchange capacity, leases, and run events. |
| pkg/…/events.proto | Explains internal job and job-run transitions, error metadata, diagnostic records, and event-log boundaries. |
| pkg/…/events.pb.go | Shows the generated Go representation of internal event sequences and their oneof event variants. |
| pkg/…/executor.pb.go | Shows the generated service boundary for executor settings and targeted control actions. |
| pkg/…/node.pb.go | Shows the generated service boundary for targeted node actions. |
| pkg/…/scheduler_reporting.pb.go | Shows the generated reporting queries for executor, queue, and job scheduling views. |
| pkg/…/binoculars.proto | Defines the log and node-cordon contract, including the current pod identity fields. |
| pkg/…/binoculars.pb.go | Shows the generated log and node-cordon service boundary used by operational tools. |
| pkg/…/api.swagger.json | Shows the HTTP form of the log and node-cordon contract. |
| pkg/…/health.pb.go | Defines the shared serving-status response used by health checks. |
| client/…/client.py | Shows a broad user-facing client around submit, query, queue, and event services. |
| client/…/client.rs | Shows a typed client boundary for transport, authentication, timeouts, submission, and watching. |
| docs/protobuf-apis-and-events.md | Provides the detailed guide to protobuf messages and event meaning. |
| docs/client-sdks.md | Provides the detailed guide to language client capabilities and use. |
| docs/event-ingestion-and-history.md | Explains how internal event records are ingested, stored, and used for history. |