Job submission and queue management
Armada's server is the control point for accepting jobs, placing them in named queues, and publishing state changes for the scheduler and other services. It checks that a caller may use a queue, keeps queue and retry policy definitions under operator control, and serves job state from the query view used by clients.
Server boundary
Armada server role
The server presents the gRPC and HTTP-facing Armada APIs. It joins authentication with submission, queue administration, retry policy management, event publishing, and job queries so that each request enters the same control-plane model.
The server does not run the workload. An accepted submission becomes an Armada event sequence for the scheduling path. Queue and retry policy definitions remain durable control data. Job and run queries read the state view produced by the wider event and scheduling system.
References: internal/…/server.go• L43-73 internal/…/server.go• L87-113 internal/…/server.go• L183-220
Submission flow
Job submission
internal/…/submit.go accepts a batch of job request items for one queue and job set. The request passes through an ordered boundary: the caller must be allowed to submit to the queue, the request must meet the submission rules, duplicate client IDs are resolved when possible, and new jobs are turned into events before they are published.
The response returns a job ID for each item. A duplicate item returns its earlier job ID and does not create a second submission. A publish failure prevents the server from recording new deduplication mappings, so callers must treat a failed request as not fully accepted rather than assume that no event was sent.
This diagram shows how a submission moves from an API request to the event stream that feeds scheduling.
flowchart LR
A[Submit job batch] --> B[Check queue access]
B --> C[Validate request]
C --> D[Resolve client ID duplicates]
D --> E[Build job events and apply defaults]
E --> F[Publish job-set event sequence]
F --> G[Return job IDs]
D --> H[Return existing job IDs]
References: internal/…/submit.go• L64-152 internal/…/deduplicaton.go• L13-17 internal/…/deduplicaton.go• L28-67 internal/…/conversions.go• L21-61
Submission rules
Validation protects the scheduler and executor from requests that do not describe a usable job. The rules require a queue, job set ID, namespace, pod specification, and valid resource declarations. They also check limits such as pod size, supported priority classes, supported affinity, port use, tolerations, termination grace period, and gang consistency.
After validation, server policy can complete or adjust the job before publication. This includes priority and resource defaults, tolerations, active deadlines, termination grace periods, gang metadata, and job ID templates. The resulting event is the contract consumed by the downstream scheduling flow.
References: internal/…/submit_request.go• L18-69 internal/…/submit_request.go• L72-83 internal/…/submit_request.go• L229-308 internal/…/post_process.go• L61-75 internal/…/post_process.go• L77-184
Queue control
Queue definitions
A queue is the named admission and scheduling boundary for jobs. Its definition carries scheduling weight, resource limits, labels, a cordon state, queue permissions, and the ordered retry policies that apply to jobs in that queue.
Queue changes are durable and are exposed through create, update, delete, read, stream, cordon, and uncordon operations. A cordoned queue remains a known queue but stops being eligible for new scheduling work. Queue-wide cancel and preempt requests publish control events for active work instead of directly changing every job in the request handler.
References: pkg/…/submit.proto• L179-207 pkg/…/submit.proto• L395-407 internal/…/queue_service.go• L46-77 internal/…/queue_service.go• L148-161 internal/…/queue_service.go• L210-333
Queue access
Queue access combines a server-wide action permission with a queue-level verb. For example, submission needs the server's submit permission or the queue's submit permission. The same boundary applies to cancel, preempt, and reprioritize actions.
Queue owners are represented as user or group subjects. Older owner fields are converted into a permission entry with all supported queue verbs, which keeps existing queue definitions compatible with the newer permission model. Queue reads do not use this action check, while queue writes use dedicated global permissions.
References: internal/…/submit.go• L75-83 internal/…/submit.go• L430-448 internal/…/permissions.go• L5-22 pkg/…/permissions.go• L16-26 pkg/…/queue.go• L90-106
Queue visibility
The server keeps a read-only queue cache for request paths that need a current queue definition, such as submission authorization. The cache refreshes from the durable queue store at a configured interval, so a recent queue change can take a short time to become visible to those paths.
The durable store is also the source for direct queue reads. It keeps retry policy attachments with their order, which lets the scheduler evaluate the first policy before later policies when a queue has more than one.
References: internal/…/queue_cache.go• L14-20 internal/…/queue_cache.go• L31-65 internal/…/queue_repository.go• L79-116 internal/…/queue_repository.go• L119-143
Retry policy
Retry policy management
A retry policy defines when a failed job may run again. It provides a retry limit, a default action, and ordered rules that can match a failure category and subcategory. A retry rule can also change placement or increase memory for the next attempt.
Operators create and update policies separately from queues. A queue attaches policies by name and order. Queue writes reject unknown policy names, while deleting a policy detaches it from queues so that policy removal does not leave invalid queue definitions.
References: pkg/…/submit.proto• L238-303 internal/…/validation.go• L18-45 internal/…/service.go• L44-103 internal/…/queue_repository.go• L201-259
Retry decisions
Retry handling belongs to the job lifecycle after a run reports a failure. The queue's policy order and the policy's explicit fail-or-retry action determine whether Armada creates another run or ends the job. A retry consumes the policy's retry budget and may carry the policy's placement or resource change into that run.
The submission and queue services define the policy contract and its attachments. The queue and job lifecycle page describes how those decisions appear as job and run state changes.
References: pkg/…/submit.proto• L238-303 pkg/…/submit.proto• L205-207 internal/…/queue_repository.go• L137-143
Query-facing state
Job and run queries
The Jobs query service provides the read side of the control plane. It returns job status, job details, run details, errors, and status lookup by an external job URI. Clients can request the job specification or run history when they need more than the current state.
The query service maps stored job and run states to API states. A missing job or an unknown stored state is returned as UNKNOWN, which makes the query result safe for clients that see a state the current API does not map.
References: internal/…/doc.go• L1-13 internal/…/query_api.go• L17-42 internal/…/query_api.go• L58-143 internal/…/query_api.go• L175-250 pkg/…/job.proto• L22-139
Active queue view
The active queue query groups queues by pool when the query view contains active work. This view answers which queues currently have activity in each pool. It is distinct from the queue definition view: a queue can exist without appearing as active.
The primary query result comes from the server's query database. Optional query mirroring replays reads against a second database for evaluation only. Mirror results and failures never change the response returned to the caller.
References: internal/…/query_api.go• L253-277 internal/…/mirror.go• L24-44 internal/…/mirror.go• L82-109 internal/…/server.go• L94-112
Related pages
Submission API
The Submission API page explains the public submission endpoints, request checks, authentication boundary, and handoff of accepted jobs into the scheduling flow.
References: pkg/…/submit.proto• L439-469 internal/…/submit.go• L64-152
Queue and job lifecycle
The Queue and job lifecycle page explains queue configuration, job state transitions, retry outcomes, executor-facing state, and the query paths that preserve job history.
References: pkg/…/submit.proto• L97-109 pkg/…/job.proto• L9-20 internal/…/query_api.go• L17-42
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to submission validation or post-processing must stay aligned with the job event shape consumed by the scheduler and executor.
- Changes to queue permission verbs must stay aligned with the server-wide action checks and the queue permission conversion rules.
- Changes to retry policy names or attachment order must preserve the queue-to-policy database contract and scheduler precedence.
- Changes to stored job or run states must update the query API state maps so clients do not receive
UNKNOWNfor a supported state. - Changes to queue cache refresh behavior must account for the delay between durable queue updates and submission authorization.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A submission names a queue that is absent from the queue cache | Authorization fails and the job does not enter the event stream | Keep queue creation and cache refresh visible before submitting jobs |
| A request fails validation | No job event is published | Check the required request, pod, resource, gang, and policy-facing limits before retrying the request |
| A caller lacks the global action or queue verb | The server returns a permission error | Grant both the needed server action and queue access where the operation requires both |
| A queue references a deleted or unknown retry policy | Queue create or update is rejected | Create the policy first or remove the stale attachment |
| A job event publish fails after only part of a batch is accepted | A retry can create duplicate jobs when deduplication data was not stored | Use a client ID for retry-safe submission and inspect returned job IDs |
| A query asks for a state not known by the API mapping | The client receives UNKNOWN | Update the stored-state mapping and API contract together |
Key files
| File | Why to read it |
|---|---|
| internal/…/server.go | Shows how the server joins submission, queues, retry policies, events, and query service into one boundary. |
| internal/…/submit.go | Shows the high-level acceptance path from authorization to published job events. |
| internal/…/submit_request.go | Defines the safety rules that a job must meet before acceptance. |
| internal/…/post_process.go | Shows which server defaults shape an accepted job. |
| internal/…/queue_service.go | Defines queue administration and queue-wide control actions. |
| internal/…/queue_repository.go | Shows durable queue definitions and retry policy attachment behavior. |
| internal/…/queue_cache.go | Explains why queue reads used by submission can lag durable queue changes. |
| internal/…/service.go | Defines the operator-facing retry policy lifecycle and permissions. |
| internal/…/query_api.go | Defines the job, run, error, and active queue read model exposed to clients. |
| pkg/…/submit.proto | Defines the shared submission, queue, retry policy, and control operation contracts. |
| pkg/…/job.proto | Defines the query-facing job and run states and read operations. |