batch

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 27 Imported by: 0

README

Batch

Parity grade: A · SDK aws-sdk-go-v2/service/batch@v1.68.4 · last audited 2026-07-25 (aad420594dea89bf7e3b745492889fee00ca2eb6)

Coverage

Metric Value
PARITY entries audited 45 (41 ok, 4 partial)
Known gaps 6
Deferred items 0
Resource leaks clean
Known gaps
  • DescribeJobs (JobDetail) still does not model attempts/nodeDetails/ecsProperties/eksProperties(describe-side) -- these require simulating multi-node/ECS/EKS job execution details (per-attempt job execution, multi-node coordination, ECS/EKS placement), genuinely out of scope for an in-memory emulator this pass. Left un-implemented rather than faked (bd: file follow-up)
  • ContainerDetail (job-level, EKS-nested EksContainer/EksPodProperties) is missing a few leaf fields real AWS has (imagePullPolicy, imagePullSecrets on EKS container/pod types) -- spot-checked against the real serializer, not exhaustively field-by-field; low priority since these are pass-through config fields with no state-machine implications (bd: file follow-up, low priority)
  • gopherstack-6flj (this session): GetJobQueueSnapshotOutput.frontOfQuotaShares and .queueUtilization (types.FrontOfQuotaSharesDetail/QueueSnapshotUtilizationDetail) are unmodeled -- both require simulating quota-share-based job ordering and per-share capacity-usage accounting this backend doesn't do (no scheduler groups RUNNABLE jobs by quota share or tracks utilization at all). frontOfQuotaShares was a previously-unflagged coverage gap in the prior audit's own field-diff note, which named only FrontOfQueueDetail/FrontOfQueueJobSummary and queueUtilization (bd: file follow-up)
  • gopherstack-6flj (this session): DescribeServiceJobOutput.attempts/capacityUsage/latestAttempt/preemptionSummary are unmodeled -- same root cause as DescribeJobs's disclosed attempts/nodeDetails gap above (no per-attempt execution simulation), plus preemptionSummary specifically requires this backend to actually preempt service jobs under quota-share contention, which it never does (bd: file follow-up)
  • 2026-08-21 (gopherstack-r80d batch 16, required-output cut): four volume/logging/multi-node sub-features are entirely unmodeled on both the input and output side, so their own required members (EFSVolumeConfiguration.FileSystemId, S3FilesVolumeConfiguration.FileSystemArn, EksPersistentVolumeClaim.ClaimName, FirelensConfiguration.Type, NodePropertyOverride.TargetNodes, all required per types/types.go) can never be populated -- gopherstack's Volume/EksVolume/ContainerProperties/ContainerDetail structs (models.go) have no fields for EFS/S3/PVC volumes or Firelens log routing at all, and SubmitJob never accepts a nodeOverrides parameter. Verified structurally absent, not sampled: grepped models.go's Volume/EksVolume/ContainerProperties/ContainerDetail field lists directly against the real types.go members. Not new bugs -- consistent with the already-disclosed multi-node/ECS/EKS-describe-side gap above; naming the specific sub-structs here so a future pass doesn't re-derive this (bd: file follow-up, low priority)
  • gopherstack-2wvq (2026-08-22): ListJobs requires jobQueue unconditionally when the real API accepts jobQueue OR arrayJobId OR multiNodeJobId as mutually-exclusive alternates (api_op_ListJobs.go). Not a safe deletion: this backend has no array-job or multi-node-job child-record model at all (SubmitJob stores ArrayProperties.Size without spawning children; NodeProperties has no per-node Job records), so serving arrayJobId/multiNodeJobId would mean returning an empty list for a genuine array/MNP submission -- a confidently-wrong 200. Declined as a genuine feature (child-job spawning, new indexes, ArrayPropertiesSummary/NodePropertiesSummary, a persisted-model version bump), not attempted (bd: file follow-up)

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a requested resource does not exist.
	ErrNotFound = awserr.New("ClientException", awserr.ErrNotFound)
	// ErrAlreadyExists is returned when a resource already exists.
	ErrAlreadyExists = awserr.New("ClientException", awserr.ErrAlreadyExists)
	// ErrValidation is returned when a request contains invalid parameters.
	ErrValidation = awserr.New("ClientException", awserr.ErrInvalidParameter)
)

Functions

This section is empty.

Types

type ArrayProperties

type ArrayProperties struct {
	StatusSummary map[string]int32 `json:"statusSummary,omitempty"`
	Size          int32            `json:"size,omitempty"`
	Index         int32            `json:"index,omitempty"`
}

ArrayProperties specifies array job fan-out configuration.

type CapacityLimit added in v1.2.0

type CapacityLimit struct {
	CapacityUnit string `json:"capacityUnit,omitempty"`
	MaxCapacity  int32  `json:"maxCapacity,omitempty"`
}

CapacityLimit specifies the maximum capacity available for a service environment.

type ComputeEnvironment

type ComputeEnvironment struct {
	Tags             map[string]string `json:"tags"`
	ComputeResources *ComputeResources `json:"computeResources,omitempty"`
	EksConfiguration *EksConfiguration `json:"eksConfiguration,omitempty"`
	UpdatePolicy     *UpdatePolicy     `json:"updatePolicy,omitempty"`

	ServiceRole            string `json:"serviceRole,omitempty"`
	ComputeEnvironmentArn  string `json:"computeEnvironmentArn"`
	Type                   string `json:"type"`
	State                  string `json:"state"`
	Status                 string `json:"status"`
	StatusReason           string `json:"statusReason,omitempty"`
	ComputeEnvironmentName string `json:"computeEnvironmentName"`
	// contains filtered or unexported fields
}

ComputeEnvironment represents a Batch compute environment.

type ComputeEnvironmentOrder

type ComputeEnvironmentOrder struct {
	ComputeEnvironment string `json:"computeEnvironment"`
	Order              int32  `json:"order"`
}

ComputeEnvironmentOrder pairs a compute environment with its ordering in a job queue.

type ComputeResources

type ComputeResources struct {
	Type               string             `json:"type,omitempty"`
	AllocationStrategy string             `json:"allocationStrategy,omitempty"`
	InstanceRole       string             `json:"instanceRole,omitempty"`
	Ec2KeyPair         string             `json:"ec2KeyPair,omitempty"`
	ImageID            string             `json:"imageId,omitempty"`
	PlacementGroup     string             `json:"placementGroup,omitempty"`
	SpotIamFleetRole   string             `json:"spotIamFleetRole,omitempty"`
	InstanceTypes      []string           `json:"instanceTypes,omitempty"`
	Subnets            []string           `json:"subnets,omitempty"`
	SecurityGroupIDs   []string           `json:"securityGroupIds,omitempty"`
	Tags               map[string]string  `json:"tags,omitempty"`
	LaunchTemplate     *LaunchTemplate    `json:"launchTemplate,omitempty"`
	Ec2Configuration   []Ec2Configuration `json:"ec2Configuration,omitempty"`
	MinvCpus           int32              `json:"minvCpus,omitempty"`
	// MaxvCpus is required whenever ComputeResources is present (the real
	// SDK client only rejects a nil pointer, not a zero value), so it must
	// never be dropped even when explicitly 0.
	MaxvCpus      int32 `json:"maxvCpus"`
	DesiredvCpus  int32 `json:"desiredvCpus,omitempty"`
	BidPercentage int32 `json:"bidPercentage,omitempty"`
}

ComputeResources holds compute resource configuration for a managed CE.

type ConfigProvider

type ConfigProvider interface {
	GetBatchSettings() Settings
}

ConfigProvider is a private interface to extract Batch configuration from the abstract AppContext Config.

type ConsumableResource

type ConsumableResource struct {
	Tags map[string]string `json:"tags"`

	ConsumableResourceName string `json:"consumableResourceName"`
	ConsumableResourceArn  string `json:"consumableResourceArn"`
	ResourceType           string `json:"resourceType,omitempty"`
	CreatedAt              int64  `json:"createdAt"`
	TotalQuantity          int64  `json:"totalQuantity"`
	AvailableQuantity      int64  `json:"availableQuantity"`
	InUseQuantity          int64  `json:"inUseQuantity"`
	// contains filtered or unexported fields
}

ConsumableResource represents a Batch consumable resource.

type ConsumableResourceProperties

type ConsumableResourceProperties struct {
	ConsumableResourceList []ConsumableResourceProperty `json:"consumableResourceList,omitempty"`
}

ConsumableResourceProperties holds the consumable resources required by a job or job definition. The real Batch API nests the requirement list under "consumableResourceList" rather than serialising it as a bare array; wrap it here so the wire shape matches (see aws-sdk-go-v2/service/batch/types. ConsumableResourceProperties).

type ConsumableResourceProperty

type ConsumableResourceProperty struct {
	ConsumableResource string `json:"consumableResource"`
	Quantity           int64  `json:"quantity"`
}

ConsumableResourceProperty specifies a single consumable resource requirement. Quantity is int64 (Long) to match aws-sdk-go-v2/service/batch/types. ConsumableResourceRequirement.Quantity exactly; it was previously float64, which is wrong for the real API (see PARITY.md gaps).

type ContainerDetail added in v1.2.0

type ContainerDetail struct {
	LinuxParameters              *LinuxParameters              `json:"linuxParameters,omitempty"`
	RepositoryCredentials        *RepositoryCredentials        `json:"repositoryCredentials,omitempty"`
	RuntimePlatform              *RuntimePlatform              `json:"runtimePlatform,omitempty"`
	EphemeralStorage             *EphemeralStorage             `json:"ephemeralStorage,omitempty"`
	FargatePlatformConfiguration *FargatePlatformConfiguration `json:"fargatePlatformConfiguration,omitempty"`
	NetworkConfiguration         *NetworkConfiguration         `json:"networkConfiguration,omitempty"`
	LogConfiguration             *LogConfiguration             `json:"logConfiguration,omitempty"`
	ExitCode                     *int32                        `json:"exitCode,omitempty"`
	JobRoleArn                   string                        `json:"jobRoleArn,omitempty"`
	ExecutionRoleArn             string                        `json:"executionRoleArn,omitempty"`
	User                         string                        `json:"user,omitempty"`
	InstanceType                 string                        `json:"instanceType,omitempty"`
	Image                        string                        `json:"image,omitempty"`
	Reason                       string                        `json:"reason,omitempty"`
	LogStreamName                string                        `json:"logStreamName,omitempty"`
	Command                      []string                      `json:"command,omitempty"`
	Secrets                      []Secret                      `json:"secrets,omitempty"`
	ResourceRequirements         []ResourceRequirement         `json:"resourceRequirements,omitempty"`
	Ulimits                      []Ulimit                      `json:"ulimits,omitempty"`
	MountPoints                  []MountPoint                  `json:"mountPoints,omitempty"`
	Volumes                      []Volume                      `json:"volumes,omitempty"`
	Environment                  []KeyValuePair                `json:"environment,omitempty"`
	Vcpus                        int32                         `json:"vcpus,omitempty"`
	Memory                       int32                         `json:"memory,omitempty"`
	ReadonlyRootFilesystem       bool                          `json:"readonlyRootFilesystem,omitempty"`
	Privileged                   bool                          `json:"privileged,omitempty"`
}

ContainerDetail mirrors aws-sdk-go-v2/service/batch/types.ContainerDetail: the describe-side view of a job's container, which is ContainerProperties plus a handful of runtime-only fields (Reason, ExitCode, LogStreamName). Placement fields real AWS populates from live ECS/EC2 state (ContainerInstanceArn, TaskArn, NetworkInterfaces, EnableExecuteCommand) aren't modeled since this emulator doesn't simulate container placement.

type ContainerOverrides

type ContainerOverrides struct {
	InstanceType         string                `json:"instanceType,omitempty"`
	Command              []string              `json:"command,omitempty"`
	Environment          []KeyValuePair        `json:"environment,omitempty"`
	ResourceRequirements []ResourceRequirement `json:"resourceRequirements,omitempty"`
}

ContainerOverrides overrides container properties at job submission time.

type ContainerProperties

type ContainerProperties struct {
	LinuxParameters              *LinuxParameters              `json:"linuxParameters,omitempty"`
	RepositoryCredentials        *RepositoryCredentials        `json:"repositoryCredentials,omitempty"`
	RuntimePlatform              *RuntimePlatform              `json:"runtimePlatform,omitempty"`
	EphemeralStorage             *EphemeralStorage             `json:"ephemeralStorage,omitempty"`
	FargatePlatformConfiguration *FargatePlatformConfiguration `json:"fargatePlatformConfiguration,omitempty"`
	NetworkConfiguration         *NetworkConfiguration         `json:"networkConfiguration,omitempty"`
	LogConfiguration             *LogConfiguration             `json:"logConfiguration,omitempty"`
	JobRoleArn                   string                        `json:"jobRoleArn,omitempty"`
	ExecutionRoleArn             string                        `json:"executionRoleArn,omitempty"`
	User                         string                        `json:"user,omitempty"`
	InstanceType                 string                        `json:"instanceType,omitempty"`
	Image                        string                        `json:"image,omitempty"`
	Command                      []string                      `json:"command,omitempty"`
	Secrets                      []Secret                      `json:"secrets,omitempty"`
	ResourceRequirements         []ResourceRequirement         `json:"resourceRequirements,omitempty"`
	Ulimits                      []Ulimit                      `json:"ulimits,omitempty"`
	MountPoints                  []MountPoint                  `json:"mountPoints,omitempty"`
	Volumes                      []Volume                      `json:"volumes,omitempty"`
	Environment                  []KeyValuePair                `json:"environment,omitempty"`
	Vcpus                        int32                         `json:"vcpus,omitempty"`
	Memory                       int32                         `json:"memory,omitempty"`
	ReadonlyRootFilesystem       bool                          `json:"readonlyRootFilesystem,omitempty"`
	Privileged                   bool                          `json:"privileged,omitempty"`
}

ContainerProperties stores container configuration for a job definition.

type Device

type Device struct {
	HostPath      string   `json:"hostPath"`
	ContainerPath string   `json:"containerPath,omitempty"`
	Permissions   []string `json:"permissions,omitempty"`
}

Device specifies a device to expose to a container.

type Ec2Configuration

type Ec2Configuration struct {
	ImageType              string `json:"imageType"`
	ImageIDOverride        string `json:"imageIdOverride,omitempty"`
	ImageKubernetesVersion string `json:"imageKubernetesVersion,omitempty"`
}

Ec2Configuration specifies AMI matching configuration for EC2 compute environments.

type EksConfiguration

type EksConfiguration struct {
	EksClusterArn       string `json:"eksClusterArn"`
	KubernetesNamespace string `json:"kubernetesNamespace"`
}

EksConfiguration specifies EKS cluster configuration for a CE.

type EksContainer

type EksContainer struct {
	Resources       *EksContainerResources `json:"resources,omitempty"`
	SecurityContext *EksSecurityContext    `json:"securityContext,omitempty"`
	Name            string                 `json:"name"`
	Image           string                 `json:"image"`
	Command         []string               `json:"command,omitempty"`
	Args            []string               `json:"args,omitempty"`
	Env             []EksContainerEnv      `json:"env,omitempty"`
	VolumeMounts    []EksVolumeMount       `json:"volumeMounts,omitempty"`
}

EksContainer specifies an EKS pod container.

type EksContainerEnv

type EksContainerEnv struct {
	Name  string `json:"name"`
	Value string `json:"value,omitempty"`
}

EksContainerEnv is a name/value env var for EKS containers.

type EksContainerResources

type EksContainerResources struct {
	Limits   map[string]string `json:"limits,omitempty"`
	Requests map[string]string `json:"requests,omitempty"`
}

EksContainerResources specifies resource limits and requests for EKS containers.

type EksEmptyDir

type EksEmptyDir struct {
	Medium    string `json:"medium,omitempty"`
	SizeLimit string `json:"sizeLimit,omitempty"`
}

EksEmptyDir specifies an emptyDir volume for EKS.

type EksHostPath

type EksHostPath struct {
	Path string `json:"path,omitempty"`
}

EksHostPath specifies a host path volume for EKS.

type EksMetadata

type EksMetadata struct {
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

EksMetadata holds labels and annotations for an EKS pod.

type EksPodProperties

type EksPodProperties struct {
	Metadata           *EksMetadata   `json:"metadata,omitempty"`
	ServiceAccountName string         `json:"serviceAccountName,omitempty"`
	DNSPolicy          string         `json:"dnsPolicy,omitempty"`
	Containers         []EksContainer `json:"containers,omitempty"`
	InitContainers     []EksContainer `json:"initContainers,omitempty"`
	Volumes            []EksVolume    `json:"volumes,omitempty"`
	HostNetwork        bool           `json:"hostNetwork,omitempty"`
}

EksPodProperties specifies the Kubernetes pod spec for an EKS job.

type EksProperties

type EksProperties struct {
	PodProperties *EksPodProperties `json:"podProperties,omitempty"`
}

EksProperties specifies EKS-specific job definition properties.

type EksSecret

type EksSecret struct {
	SecretName string `json:"secretName"`
	Optional   bool   `json:"optional,omitempty"`
}

EksSecret specifies a Kubernetes secret volume for EKS.

type EksSecurityContext

type EksSecurityContext struct {
	RunAsUser                *int64 `json:"runAsUser,omitempty"`
	RunAsGroup               *int64 `json:"runAsGroup,omitempty"`
	Privileged               bool   `json:"privileged,omitempty"`
	ReadOnlyRootFilesystem   bool   `json:"readOnlyRootFilesystem,omitempty"`
	RunAsNonRoot             bool   `json:"runAsNonRoot,omitempty"`
	AllowPrivilegeEscalation bool   `json:"allowPrivilegeEscalation,omitempty"`
}

EksSecurityContext specifies security settings for an EKS container.

type EksVolume

type EksVolume struct {
	HostPath *EksHostPath `json:"hostPath,omitempty"`
	EmptyDir *EksEmptyDir `json:"emptyDir,omitempty"`
	Secret   *EksSecret   `json:"secret,omitempty"`
	Name     string       `json:"name"`
}

EksVolume specifies a volume available to EKS pod containers.

type EksVolumeMount

type EksVolumeMount struct {
	Name      string `json:"name"`
	MountPath string `json:"mountPath"`
	ReadOnly  bool   `json:"readOnly,omitempty"`
}

EksVolumeMount mounts a volume into an EKS container.

type EphemeralStorage

type EphemeralStorage struct {
	SizeInGiB int32 `json:"sizeInGiB"`
}

EphemeralStorage specifies ephemeral storage capacity for Fargate tasks.

type EvaluateOnExit

type EvaluateOnExit struct {
	Action         string `json:"action"`
	OnStatusReason string `json:"onStatusReason,omitempty"`
	OnReason       string `json:"onReason,omitempty"`
	OnExitCode     string `json:"onExitCode,omitempty"`
}

EvaluateOnExit specifies a conditional retry rule evaluated against exit information.

type FairsharePolicy

type FairsharePolicy struct {
	ShareDistribution  []ShareDistribution `json:"shareDistribution,omitempty"`
	ShareDecaySeconds  int32               `json:"shareDecaySeconds,omitempty"`
	ComputeReservation int32               `json:"computeReservation,omitempty"`
}

FairsharePolicy configures fair-share scheduling for a scheduling policy.

type FargatePlatformConfiguration

type FargatePlatformConfiguration struct {
	PlatformVersion string `json:"platformVersion,omitempty"`
}

FargatePlatformConfiguration specifies the Fargate platform version.

type FrontOfQueue

type FrontOfQueue struct {
	Jobs          []FrontOfQueueJob `json:"jobs,omitempty"`
	LastUpdatedAt int64             `json:"lastUpdatedAt,omitempty"`
}

FrontOfQueue holds jobs at the front of a job queue. Field names and types mirror aws-sdk-go-v2/service/batch/types.FrontOfQueueDetail exactly: LastUpdatedAt (not "timestamp") as an epoch-millisecond int64 (not a seconds-based float64) -- a real SDK client parsing the previous shape would have silently dropped both fields.

type FrontOfQueueJob

type FrontOfQueueJob struct {
	JobArn                 string `json:"jobArn"`
	EarliestTimeAtPosition int64  `json:"earliestTimeAtPosition,omitempty"`
}

FrontOfQueueJob represents a single job at the front of a queue. EarliestTimeAtPosition is an epoch-millisecond int64, matching aws-sdk-go-v2/service/batch/types.FrontOfQueueJobSummary (not a seconds-based float64).

type Handler

type Handler struct {
	Backend *InMemoryBackend
	// contains filtered or unexported fields
}

Handler is the Echo HTTP handler for AWS Batch operations.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a new Batch handler backed by backend. backend must not be nil.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns all regions this handler instance handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation returns the operation name from the request path and method.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource extracts a resource identifier from the request path.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns the list of supported operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function for Batch requests.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a function that matches Batch requests. It matches /v1/ paths but explicitly excludes /v1/apis (AppSync), CodeArtifact paths, and Kafka paths to prevent routing conflicts when multiple services use PriorityPathVersioned. The tags path is scoped by ARN via isBatchTagPath instead of excluded outright, since Batch owns its own ARNs there too (see isAppSyncTagPath in services/appsync/handler.go for the mirrored guard that stops AppSync's tag-path matcher from claiming Batch's ARNs in the first place).

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

func (*Handler) StartWorker

func (h *Handler) StartWorker(ctx context.Context) error

StartWorker starts the background janitor if configured. It always returns nil; the error return satisfies the service.BackgroundWorker interface.

func (*Handler) WithJanitor

func (h *Handler) WithJanitor(
	interval, inactiveJobDefTTL, completedJobTTL time.Duration,
	taskTimeout ...time.Duration,
) *Handler

WithJanitor attaches a background janitor to the handler. Zero values for interval, inactiveJobDefTTL, or completedJobTTL use defaults. The optional taskTimeout bounds each sweep; 0 means no per-task timeout.

type HostVolume

type HostVolume struct {
	SourcePath string `json:"sourcePath,omitempty"`
}

HostVolume specifies a host-path volume binding.

type InMemoryBackend

type InMemoryBackend struct {
	// contains filtered or unexported fields
}

InMemoryBackend stores AWS Batch state in memory.

The eight resource collections below (computeEnvironments, jobQueues, jobDefinitions, jobs, consumableResources, schedulingPolicies, serviceEnvironments, serviceJobs) were previously nested by region (outer key = region, e.g. map[string]map[string]*Job); each is now a single flat *store.Table[T] keyed by the composite "region|id" string (see regionKey), with a companion *store.Index grouping entries by region for per-region scans/pagination -- the region-qualified-table pattern services/emr and services/mwaa use (Phase 3.3 of the datalayer refactor). jobs additionally carries a "byARN" index (replacing the old jobsByARN region-nested map) and a "byQueue" index (replacing jobsByQueue), both maintained automatically by store.Table on every Put/Delete/Restore.

jobDefRevisions (a per-region name -> revision-counter map, not a *T map) is left as a plain region-nested map since store.Table requires pointer identity values; it is persisted directly, unchanged from before.

cesByARN, jqsByARN, crsByARN and ceToQueues are also left as plain maps: the first three hold bare strings (no *T identity) and were already write-only/dead for reads before this refactor; ceToQueues is a non-*T set-of-sets used only for the CE-in-use-by-queue check. None of the four are region-nested (a pre-existing quirk, e.g. a same-named CE in two regions shares one cesByARN slot) and none are persisted -- both facts predate this refactor and are preserved byte-for-byte, not fixed here.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new InMemoryBackend.

func (*InMemoryBackend) CancelJob

func (b *InMemoryBackend) CancelJob(ctx context.Context, idOrARN, reason string) error

CancelJob cancels a job in SUBMITTED, PENDING, or RUNNABLE state. Accepts job ID or ARN.

func (*InMemoryBackend) CreateComputeEnvironment

func (b *InMemoryBackend) CreateComputeEnvironment(
	ctx context.Context,
	name, ceType, state string,
	tags map[string]string,
	serviceRole string,
	computeResources *ComputeResources,
	eksConfig *EksConfiguration,
	updatePolicy *UpdatePolicy,
) (*ComputeEnvironment, error)

CreateComputeEnvironment creates a new compute environment.

func (*InMemoryBackend) CreateConsumableResource

func (b *InMemoryBackend) CreateConsumableResource(
	ctx context.Context,
	name, resourceType string,
	totalQuantity int64,
	tags map[string]string,
) (*ConsumableResource, error)

CreateConsumableResource creates a new consumable resource.

func (*InMemoryBackend) CreateJobQueue

func (b *InMemoryBackend) CreateJobQueue(
	ctx context.Context,
	name string,
	priority int32,
	state string,
	ceOrder []ComputeEnvironmentOrder,
	tags map[string]string,
	schedulingPolicyArn string,
	jobStateTimeLimitActions []JobStateTimeLimitAction,
	jobQueueType string,
	serviceEnvironmentOrder []ServiceEnvironmentOrder,
) (*JobQueue, error)

CreateJobQueue creates a new job queue.

func (*InMemoryBackend) CreateQuotaShare added in v1.2.0

func (b *InMemoryBackend) CreateQuotaShare(
	ctx context.Context,
	name, jobQueue string,
	capacityLimits []QuotaShareCapacityLimit,
	preemption *QuotaSharePreemptionConfiguration,
	resourceSharing *QuotaShareResourceSharingConfiguration,
	state string,
	tags map[string]string,
) (*QuotaShare, error)

CreateQuotaShare creates a new quota share associated with an existing job queue. Real AWS Batch requires the referenced job queue to already exist and be in the VALID state before it can be associated with a quota share (see CreateQuotaShareInput's jobQueue documentation); this emulator's job queues are always created VALID (see statusValid in store.go) and never transition away from it, so the state check below, while real, is not currently reachable through this backend's own state machine.

func (*InMemoryBackend) CreateSchedulingPolicy

func (b *InMemoryBackend) CreateSchedulingPolicy(
	ctx context.Context,
	name string,
	tags map[string]string,
	fairsharePolicy *FairsharePolicy,
	quotaSharePolicy *QuotaSharePolicy,
) (*SchedulingPolicy, error)

CreateSchedulingPolicy creates a new scheduling policy.

func (*InMemoryBackend) CreateServiceEnvironment

func (b *InMemoryBackend) CreateServiceEnvironment(
	ctx context.Context,
	name, envType, state string,
	capacityLimits []CapacityLimit,
	tags map[string]string,
) (*ServiceEnvironment, error)

CreateServiceEnvironment creates a new service environment.

func (*InMemoryBackend) DeleteComputeEnvironment

func (b *InMemoryBackend) DeleteComputeEnvironment(ctx context.Context, nameOrARN string) error

DeleteComputeEnvironment removes a compute environment.

func (*InMemoryBackend) DeleteConsumableResource

func (b *InMemoryBackend) DeleteConsumableResource(ctx context.Context, nameOrARN string) error

DeleteConsumableResource removes a consumable resource by name or ARN.

func (*InMemoryBackend) DeleteJobQueue

func (b *InMemoryBackend) DeleteJobQueue(ctx context.Context, nameOrARN string) error

DeleteJobQueue removes a job queue and all associated jobs. The queue must be in DISABLED state before deletion.

func (*InMemoryBackend) DeleteQuotaShare added in v1.2.0

func (b *InMemoryBackend) DeleteQuotaShare(ctx context.Context, quotaShareARN string) error

DeleteQuotaShare removes a quota share by ARN.

func (*InMemoryBackend) DeleteSchedulingPolicy

func (b *InMemoryBackend) DeleteSchedulingPolicy(ctx context.Context, policyARN string) error

DeleteSchedulingPolicy removes a scheduling policy by ARN.

func (*InMemoryBackend) DeleteServiceEnvironment

func (b *InMemoryBackend) DeleteServiceEnvironment(ctx context.Context, nameOrARN string) error

DeleteServiceEnvironment removes a service environment by name or ARN.

func (*InMemoryBackend) DeregisterJobDefinition

func (b *InMemoryBackend) DeregisterJobDefinition(ctx context.Context, arnOrNameRev string) error

DeregisterJobDefinition marks a job definition as INACTIVE by ARN or name:revision. INACTIVE definitions remain visible in DescribeJobDefinitions (matching AWS behavior) and are swept by the janitor after the configured TTL.

func (*InMemoryBackend) DescribeComputeEnvironments

func (b *InMemoryBackend) DescribeComputeEnvironments(
	ctx context.Context,
	names []string,
	maxResults int32,
	nextToken string,
) ([]*ComputeEnvironment, string)

DescribeComputeEnvironments returns compute environments, optionally filtered by names/ARNs. When names is empty, results are paginated via maxResults/nextToken.

func (*InMemoryBackend) DescribeConsumableResource

func (b *InMemoryBackend) DescribeConsumableResource(
	ctx context.Context,
	nameOrARN string,
) (*ConsumableResource, error)

DescribeConsumableResource returns details for a consumable resource identified by name or ARN.

func (*InMemoryBackend) DescribeJobDefinitions

func (b *InMemoryBackend) DescribeJobDefinitions(
	ctx context.Context,
	names []string,
	status, jobDefinitionName string,
	maxResults int32,
	nextToken string,
) ([]*JobDefinition, string)

DescribeJobDefinitions returns job definitions, optionally filtered by names/ARNs. When names is empty, results are paginated via maxResults/nextToken.

func (*InMemoryBackend) DescribeJobQueues

func (b *InMemoryBackend) DescribeJobQueues(
	ctx context.Context,
	names []string,
	maxResults int32,
	nextToken string,
) ([]*JobQueue, string)

DescribeJobQueues returns job queues, optionally filtered by names/ARNs. When names are provided, all matching queues are returned without pagination. When names is empty, results are paginated using maxResults and nextToken.

func (*InMemoryBackend) DescribeJobs

func (b *InMemoryBackend) DescribeJobs(ctx context.Context, jobIDs []string) []*Job

DescribeJobs returns full job details for the given job IDs or ARNs.

func (*InMemoryBackend) DescribeQuotaShare added in v1.2.0

func (b *InMemoryBackend) DescribeQuotaShare(ctx context.Context, quotaShareARN string) (*QuotaShare, error)

DescribeQuotaShare returns a single quota share by ARN.

func (*InMemoryBackend) DescribeSchedulingPolicies

func (b *InMemoryBackend) DescribeSchedulingPolicies(ctx context.Context, arns []string) []*SchedulingPolicy

DescribeSchedulingPolicies returns scheduling policies, optionally filtered by ARNs.

func (*InMemoryBackend) DescribeServiceEnvironments

func (b *InMemoryBackend) DescribeServiceEnvironments(
	ctx context.Context,
	names []string,
	maxResults int32,
	nextToken string,
) ([]*ServiceEnvironment, string)

DescribeServiceEnvironments returns service environments, optionally filtered by names/ARNs. When names is empty, results are paginated via maxResults/nextToken, matching aws-sdk-go-v2/service/batch's DescribeServiceEnvironmentsInput.

func (*InMemoryBackend) DescribeServiceJob

func (b *InMemoryBackend) DescribeServiceJob(ctx context.Context, jobID string) (*ServiceJob, error)

DescribeServiceJob returns a single service job by ID.

func (*InMemoryBackend) GetJobQueueSnapshot

func (b *InMemoryBackend) GetJobQueueSnapshot(ctx context.Context, jobQueue string) (*JobQueueSnapshot, error)

GetJobQueueSnapshot returns a snapshot of the front of a job queue.

func (*InMemoryBackend) ListConsumableResources

func (b *InMemoryBackend) ListConsumableResources(ctx context.Context) []*ConsumableResource

ListConsumableResources returns all consumable resources sorted by name.

func (*InMemoryBackend) ListJobs

func (b *InMemoryBackend) ListJobs(
	ctx context.Context,
	queue, status, nextToken string,
	maxResults int32,
) ([]*Job, string, error)

ListJobs returns job summaries for a queue, optionally filtered by status. Matching real AWS Batch's documented ListJobs behavior (api_op_ListJobs.go: "If you don't specify a status, only RUNNING jobs are returned"), an unspecified status defaults to RUNNING -- same pattern as ListServiceJobs. Pagination is controlled via maxResults and nextToken (token encodes an integer offset).

func (*InMemoryBackend) ListJobsByConsumableResource

func (b *InMemoryBackend) ListJobsByConsumableResource(
	ctx context.Context,
	consumableResource string,
) ([]*Job, error)

ListJobsByConsumableResource returns jobs that reference the named consumable resource via their ConsumableResourceProperties.

func (*InMemoryBackend) ListQuotaShares added in v1.2.0

func (b *InMemoryBackend) ListQuotaShares(ctx context.Context, jobQueue string) ([]*QuotaShare, error)

ListQuotaShares returns every quota share associated with jobQueue, sorted by quota share name. jobQueue is required and must reference an existing job queue (matching ListQuotaSharesInput, where jobQueue is a required field). Pagination (maxResults/nextToken) is applied by the caller (see handleListQuotaShares), matching the shared convention used by ListSchedulingPolicies/ListConsumableResources.

func (*InMemoryBackend) ListSchedulingPolicies

func (b *InMemoryBackend) ListSchedulingPolicies(ctx context.Context) []*SchedulingPolicy

ListSchedulingPolicies returns all scheduling policies sorted by ARN.

func (*InMemoryBackend) ListServiceJobs

func (b *InMemoryBackend) ListServiceJobs(ctx context.Context, jobQueue, jobStatus string) ([]*ServiceJob, error)

ListServiceJobs returns service jobs for a job queue, optionally filtered by status. Matching real AWS Batch's documented ListServiceJobs behavior, an unspecified jobStatus defaults to returning only RUNNING jobs.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(ctx context.Context, resourceARN string) (map[string]string, error)

ListTagsForResource returns the tags for a resource identified by ARN.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the AWS region this backend is configured for.

func (*InMemoryBackend) RegisterJobDefinition

func (b *InMemoryBackend) RegisterJobDefinition(
	ctx context.Context,
	name, defType string,
	tags map[string]string,
	platformCapabilities []string,
	timeoutSeconds int32,
	schedulingPriority int32,
	containerProps *ContainerProperties,
	nodeProps *NodeProperties,
	eksProps *EksProperties,
	runtimePlatform *RuntimePlatform,
	consumableResourceProperties []ConsumableResourceProperty,
	parameters map[string]string,
	propagateTags bool,
	retryStrategy *RetryStrategy,
) (*JobDefinition, error)

RegisterJobDefinition registers a new job definition (or a new revision).

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all state from the backend.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state to JSON. It implements persistence.Persistable.

func (*InMemoryBackend) SubmitJob

func (b *InMemoryBackend) SubmitJob(
	ctx context.Context,
	name, queue, jobDefinition string,
	tags map[string]string,
	parameters map[string]string,
	dependsOn []JobDependency,
	retryStrategy *RetryStrategy,
	timeout *JobTimeout,
	arrayProperties *ArrayProperties,
	containerOverrides *ContainerOverrides,
	consumableResourceProperties []ConsumableResourceProperty,
	shareIdentifier string,
	schedulingPriorityOverride int32,
	propagateTags bool,
) (*Job, error)

SubmitJob submits a new Batch job for execution.

func (*InMemoryBackend) SubmitServiceJob

func (b *InMemoryBackend) SubmitServiceJob(
	ctx context.Context,
	name, jobQueue, serviceJobType, serviceRequestPayload string,
	tags map[string]string,
	retryStrategy *ServiceJobRetryStrategy,
	timeoutConfig *ServiceJobTimeout,
	schedulingPriority int32,
	shareIdentifier, quotaShareName string,
	preemptionConfig *ServiceJobPreemptionConfiguration,
) (*ServiceJob, error)

SubmitServiceJob creates a new service job in SUBMITTED status. Service jobs are submitted directly to a job queue (real AWS Batch requires the queue to be of type SAGEMAKER_TRAINING; this emulator doesn't enforce that cross-field constraint since it doesn't simulate SageMaker Training capacity). See models.go's ServiceJob doc comment for why there is no separate "service environment" parameter here.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(ctx context.Context, resourceARN string, tags map[string]string) error

TagResource adds or updates tags on a resource identified by ARN.

func (*InMemoryBackend) TaggedResources added in v1.2.0

func (b *InMemoryBackend) TaggedResources() []TaggedEntry

TaggedResources returns every Batch resource ARN that currently has at least one tag, across every taggable Batch resource kind (compute environments, job queues, job definitions, jobs, consumable resources, scheduling policies, service environments, service jobs).

func (*InMemoryBackend) TerminateJob

func (b *InMemoryBackend) TerminateJob(ctx context.Context, idOrARN, reason string) error

TerminateJob marks a job as FAILED with the given reason. Valid for any non-terminal state. Accepts job ID or ARN.

func (*InMemoryBackend) TerminateServiceJob

func (b *InMemoryBackend) TerminateServiceJob(ctx context.Context, jobID, reason string) error

TerminateServiceJob marks a service job as FAILED.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(ctx context.Context, resourceARN string, tagKeys []string) error

UntagResource removes tags from a resource identified by ARN.

func (*InMemoryBackend) UpdateComputeEnvironment

func (b *InMemoryBackend) UpdateComputeEnvironment(
	ctx context.Context,
	nameOrARN, state, serviceRole string,
	computeResources *ComputeResources,
	updatePolicy *UpdatePolicy,
) (*ComputeEnvironment, error)

UpdateComputeEnvironment updates the state, service role, compute resources, and/or update policy.

func (*InMemoryBackend) UpdateConsumableResource

func (b *InMemoryBackend) UpdateConsumableResource(
	ctx context.Context,
	nameOrARN, operation string,
	quantity int64,
) (*ConsumableResource, error)

UpdateConsumableResource updates the quantity of a consumable resource.

func (*InMemoryBackend) UpdateJobQueue

func (b *InMemoryBackend) UpdateJobQueue(
	ctx context.Context,
	nameOrARN string,
	priority *int32,
	state string,
	ceOrder []ComputeEnvironmentOrder,
	jobStateTimeLimitActions []JobStateTimeLimitAction,
	serviceEnvironmentOrder []ServiceEnvironmentOrder,
) (*JobQueue, error)

UpdateJobQueue updates a job queue's state, priority, CE order, and/or time-limit actions.

func (*InMemoryBackend) UpdateQuotaShare added in v1.2.0

func (b *InMemoryBackend) UpdateQuotaShare(
	ctx context.Context,
	quotaShareARN string,
	capacityLimits []QuotaShareCapacityLimit,
	preemption *QuotaSharePreemptionConfiguration,
	resourceSharing *QuotaShareResourceSharingConfiguration,
	state string,
) (*QuotaShare, error)

UpdateQuotaShare updates a quota share's capacity limits, preemption configuration, resource sharing configuration, and/or state. Only non-nil/non-empty fields are applied, matching UpdateQuotaShareInput where everything except quotaShareArn is optional.

func (*InMemoryBackend) UpdateSchedulingPolicy

func (b *InMemoryBackend) UpdateSchedulingPolicy(
	ctx context.Context,
	policyARN string,
	fairsharePolicy *FairsharePolicy,
	quotaSharePolicy *QuotaSharePolicy,
) error

UpdateSchedulingPolicy updates a scheduling policy's fairshare/quota-share configuration.

func (*InMemoryBackend) UpdateServiceEnvironment

func (b *InMemoryBackend) UpdateServiceEnvironment(
	ctx context.Context,
	nameOrARN, state string,
	capacityLimits []CapacityLimit,
) (*ServiceEnvironment, error)

UpdateServiceEnvironment updates the state and/or capacity limits of a service environment.

func (*InMemoryBackend) UpdateServiceJob added in v1.2.0

func (b *InMemoryBackend) UpdateServiceJob(
	ctx context.Context,
	jobID string,
	schedulingPriority int32,
) (*ServiceJob, error)

UpdateServiceJob updates the scheduling priority of an existing service job. Real AWS Batch's UpdateServiceJobInput has exactly two fields -- jobId and schedulingPriority, both required -- and no others (see aws-sdk-go-v2/service/batch's UpdateServiceJobInput/UpdateServiceJob doc comment: "Updates the priority of a specified service job"); there is no way to change jobQueue, retryStrategy, tags, or any other field of a submitted service job via this or any other operation. Matching the terminal-state guard CancelJob already applies to regular jobs (see jobs.go), a service job that has already reached a terminal status (SUCCEEDED or FAILED) rejects the update: scheduling priority only affects a job's position within a quota-share/fair-share queue while it is still competing for capacity, which no longer applies once the job has finished.

type Janitor

type Janitor struct {
	Backend           *InMemoryBackend
	Interval          time.Duration
	InactiveJobDefTTL time.Duration
	CompletedJobTTL   time.Duration
	TaskTimeout       time.Duration
}

Janitor is the Batch background worker that evicts INACTIVE job definitions after a configurable TTL to prevent unbounded growth of in-memory state. This matches AWS behavior where deregistered definitions eventually disappear. It also evicts completed and failed jobs after a configurable TTL, matching the AWS Batch job history retention behavior.

func NewJanitor

func NewJanitor(backend *InMemoryBackend, interval, inactiveJobDefTTL, completedJobTTL time.Duration) *Janitor

NewJanitor creates a new Batch Janitor for the given backend. Zero values for interval, inactiveJobDefTTL, or completedJobTTL fall back to defaults.

func (*Janitor) Run

func (j *Janitor) Run(ctx context.Context)

Run runs the janitor loop until ctx is cancelled.

func (*Janitor) SweepOnce

func (j *Janitor) SweepOnce(ctx context.Context)

SweepOnce runs a single sweep pass. Exposed for testing.

type Job

type Job struct {
	ContainerOverrides *ContainerOverrides `json:"containerOverrides,omitempty"`
	Tags               map[string]string   `json:"tags"`
	Parameters         map[string]string   `json:"parameters,omitempty"`
	StartedAt          *int64              `json:"startedAt,omitempty"`
	StoppedAt          *int64              `json:"stoppedAt,omitempty"`
	RetryStrategy      *RetryStrategy      `json:"retryStrategy,omitempty"`
	Timeout            *JobTimeout         `json:"timeout,omitempty"`
	ArrayProperties    *ArrayProperties    `json:"arrayProperties,omitempty"`
	// Container is derived (not stored directly by callers) from the resolved
	// job definition's ContainerProperties merged with ContainerOverrides; it
	// is populated by DescribeJobs. Left nil for multi-node jobs, matching
	// AWS's "for a multiple-container job, this object will be empty" note.
	Container *ContainerDetail `json:"container,omitempty"`

	JobDefinition                string                        `json:"jobDefinition"`
	ShareIdentifier              string                        `json:"shareIdentifier,omitempty"`
	StatusReason                 string                        `json:"statusReason,omitempty"`
	JobID                        string                        `json:"jobId"`
	JobARN                       string                        `json:"jobArn"`
	JobName                      string                        `json:"jobName"`
	JobQueue                     string                        `json:"jobQueue"`
	Status                       string                        `json:"status"`
	DependsOn                    []JobDependency               `json:"dependsOn,omitempty"`
	ConsumableResourceProperties *ConsumableResourceProperties `json:"consumableResourceProperties,omitempty"`
	Attempts                     []JobAttempt                  `json:"attempts,omitempty"`
	// PlatformCapabilities is copied from the resolved job definition at
	// SubmitJob time (real AWS defaults to ["EC2"] when unspecified).
	PlatformCapabilities       []string `json:"platformCapabilities,omitempty"`
	CreatedAt                  int64    `json:"createdAt"`
	SchedulingPriorityOverride int32    `json:"schedulingPriorityOverride,omitempty"`
	PropagateTags              bool     `json:"propagateTags,omitempty"`
	// IsCancelled/IsTerminated are set by CancelJob/TerminateJob respectively;
	// see aws-sdk-go-v2/service/batch/types.JobDetail.IsCancelled/IsTerminated.
	IsCancelled  bool `json:"isCancelled"`
	IsTerminated bool `json:"isTerminated"`
	// contains filtered or unexported fields
}

Job represents a submitted Batch job.

type JobAttempt

type JobAttempt struct {
	Container    *JobAttemptContainer `json:"container,omitempty"`
	StartedAt    *int64               `json:"startedAt,omitempty"`
	StoppedAt    *int64               `json:"stoppedAt,omitempty"`
	StatusReason string               `json:"statusReason,omitempty"`
}

JobAttempt holds per-attempt lifecycle and result information.

type JobAttemptContainer

type JobAttemptContainer struct {
	LogStreamName string `json:"logStreamName,omitempty"`
	Reason        string `json:"reason,omitempty"`
	ExitCode      int32  `json:"exitCode,omitempty"`
}

JobAttemptContainer holds per-attempt container execution details.

type JobDefinition

type JobDefinition struct {
	DeregisteredAt      *time.Time           `json:"deregisteredAt,omitempty"`
	Tags                map[string]string    `json:"tags"`
	Parameters          map[string]string    `json:"parameters,omitempty"`
	ContainerProperties *ContainerProperties `json:"containerProperties,omitempty"`
	NodeProperties      *NodeProperties      `json:"nodeProperties,omitempty"`
	EksProperties       *EksProperties       `json:"eksProperties,omitempty"`
	RuntimePlatform     *RuntimePlatform     `json:"runtimePlatform,omitempty"`
	// RetryStrategy is the job-definition-level default retry strategy (real
	// AWS Batch supports this in addition to the job-level RetryStrategy
	// passed to SubmitJob; see aws-sdk-go-v2/service/batch/types.
	// RegisterJobDefinitionInput.RetryStrategy).
	RetryStrategy *RetryStrategy `json:"retryStrategy,omitempty"`
	// Timeout is nested (wire key "timeout": {"attemptDurationSeconds": N}) to
	// match aws-sdk-go-v2/service/batch/types.JobDefinition.Timeout; it must
	// NOT be a flat "timeoutSeconds" integer.
	Timeout *JobTimeout `json:"timeout,omitempty"`

	ConsumableResourceProperties *ConsumableResourceProperties `json:"consumableResourceProperties,omitempty"`
	JobDefinitionName            string                        `json:"jobDefinitionName"`
	JobDefinitionArn             string                        `json:"jobDefinitionArn"`
	Type                         string                        `json:"type"`
	Status                       string                        `json:"status"`
	PlatformCapabilities         []string                      `json:"platformCapabilities,omitempty"`
	Revision                     int32                         `json:"revision"`
	SchedulingPriority           int32                         `json:"schedulingPriority,omitempty"`
	PropagateTags                bool                          `json:"propagateTags,omitempty"`
	// contains filtered or unexported fields
}

JobDefinition represents a Batch job definition.

type JobDependency

type JobDependency struct {
	JobID string `json:"jobId,omitempty"`
	Type  string `json:"type,omitempty"`
}

JobDependency represents a dependency between jobs.

type JobQueue

type JobQueue struct {
	Tags map[string]string `json:"tags"`

	JobQueueName        string `json:"jobQueueName"`
	JobQueueArn         string `json:"jobQueueArn"`
	State               string `json:"state"`
	Status              string `json:"status"`
	StatusReason        string `json:"statusReason,omitempty"`
	SchedulingPolicyArn string `json:"schedulingPolicyArn,omitempty"`
	JobQueueType        string `json:"jobQueueType,omitempty"`
	// ComputeEnvironmentOrder is required on JobQueueDetail even when the
	// queue was built purely from ServiceEnvironmentOrder instead (the two
	// are mutually exclusive on input) -- must serialize as [] not be
	// omitted; see cloneJobQueueWithTags.
	ComputeEnvironmentOrder  []ComputeEnvironmentOrder `json:"computeEnvironmentOrder"`
	ServiceEnvironmentOrder  []ServiceEnvironmentOrder `json:"serviceEnvironmentOrder,omitempty"`
	JobStateTimeLimitActions []JobStateTimeLimitAction `json:"jobStateTimeLimitActions,omitempty"`
	Priority                 int32                     `json:"priority"`
	// contains filtered or unexported fields
}

JobQueue represents a Batch job queue.

type JobQueueSnapshot

type JobQueueSnapshot struct {
	FrontOfQueue *FrontOfQueue `json:"frontOfQueue,omitempty"`
}

JobQueueSnapshot represents the front-of-queue state for a job queue.

type JobStateTimeLimitAction

type JobStateTimeLimitAction struct {
	Reason         string `json:"reason"`
	State          string `json:"state"`
	Action         string `json:"action"`
	MaxTimeSeconds int32  `json:"maxTimeSeconds"`
}

JobStateTimeLimitAction cancels jobs stuck in a given state beyond a time limit.

type JobTimeout

type JobTimeout struct {
	AttemptDurationSeconds int32 `json:"attemptDurationSeconds,omitempty"`
}

JobTimeout configures the maximum duration for a job attempt.

type KeyValuePair

type KeyValuePair struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

KeyValuePair is a name/value environment variable pair.

type LaunchTemplate

type LaunchTemplate struct {
	LaunchTemplateName string                   `json:"launchTemplateName,omitempty"`
	LaunchTemplateID   string                   `json:"launchTemplateId,omitempty"`
	Version            string                   `json:"version,omitempty"`
	Overrides          []LaunchTemplateOverride `json:"overrides,omitempty"`
}

LaunchTemplate specifies an EC2 launch template.

type LaunchTemplateOverride

type LaunchTemplateOverride struct {
	LaunchTemplateName  string   `json:"launchTemplateName,omitempty"`
	LaunchTemplateID    string   `json:"launchTemplateId,omitempty"`
	Version             string   `json:"version,omitempty"`
	TargetInstanceTypes []string `json:"targetInstanceTypes,omitempty"`
}

LaunchTemplateOverride specifies a launch template override for specific instance types.

type LinuxParameters

type LinuxParameters struct {
	Devices            []Device `json:"devices,omitempty"`
	Tmpfs              []Tmpfs  `json:"tmpfs,omitempty"`
	InitProcessEnabled bool     `json:"initProcessEnabled,omitempty"`
	SharedMemorySize   int32    `json:"sharedMemorySize,omitempty"`
	MaxSwap            int32    `json:"maxSwap,omitempty"`
	Swappiness         int32    `json:"swappiness,omitempty"`
}

LinuxParameters configures Linux-specific container settings.

type LogConfiguration

type LogConfiguration struct {
	Options   map[string]string `json:"options,omitempty"`
	LogDriver string            `json:"logDriver"`
}

LogConfiguration specifies the log driver configuration for a container.

type MountPoint

type MountPoint struct {
	ContainerPath string `json:"containerPath,omitempty"`
	SourceVolume  string `json:"sourceVolume,omitempty"`
	ReadOnly      bool   `json:"readOnly,omitempty"`
}

MountPoint maps a volume into a container.

type NetworkConfiguration

type NetworkConfiguration struct {
	AssignPublicIP string `json:"assignPublicIp,omitempty"`
}

NetworkConfiguration specifies network settings for Fargate containers.

type NodeProperties

type NodeProperties struct {
	NodeRangeProperties []NodeRangeProperty `json:"nodeRangeProperties"`
	NumNodes            int32               `json:"numNodes"`
	MainNode            int32               `json:"mainNode"`
}

NodeProperties specifies multi-node parallel job configuration.

type NodeRangeProperty

type NodeRangeProperty struct {
	ContainerProperties *ContainerProperties `json:"containerProperties,omitempty"`
	TargetNodes         string               `json:"targetNodes"`
}

NodeRangeProperty specifies container properties for a range of multi-node job nodes.

type Provider

type Provider struct{}

Provider implements service.Provider for Batch.

func (*Provider) Init

Init initializes the Batch backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type QuotaShare added in v1.2.0

type QuotaShare struct {
	Tags                         map[string]string                       `json:"tags"`
	PreemptionConfiguration      *QuotaSharePreemptionConfiguration      `json:"preemptionConfiguration,omitempty"`
	ResourceSharingConfiguration *QuotaShareResourceSharingConfiguration `json:"resourceSharingConfiguration,omitempty"`

	QuotaShareArn  string                    `json:"quotaShareArn"`
	QuotaShareName string                    `json:"quotaShareName"`
	JobQueueArn    string                    `json:"jobQueueArn,omitempty"`
	State          string                    `json:"state,omitempty"`
	Status         string                    `json:"status,omitempty"`
	CapacityLimits []QuotaShareCapacityLimit `json:"capacityLimits,omitempty"`
	// contains filtered or unexported fields
}

QuotaShare represents a Batch quota share: a virtual queue with a configured compute capacity, resource sharing strategy, and borrow limits, associated with an existing JobQueue (see CreateQuotaShareInput's required jobQueue field in aws-sdk-go-v2/service/batch). This is a distinct top-level resource family from SchedulingPolicy/FairsharePolicy/ ShareIdentifier -- CreateQuotaShareInput has no schedulingPolicyArn or shareIdentifier field at all, and QuotaShareDetail's ARN shape (job-queue/{queueName}/quota-share/{quotaShareName}, confirmed against the AWS API reference's CreateQuotaShare example) nests under the job queue's own ARN rather than referencing a SchedulingPolicy resource.

type QuotaShareCapacityLimit added in v1.2.0

type QuotaShareCapacityLimit struct {
	CapacityUnit string `json:"capacityUnit,omitempty"`
	MaxCapacity  int32  `json:"maxCapacity"`
}

QuotaShareCapacityLimit specifies the quantity and type of compute capacity allocated to a quota share. See aws-sdk-go-v2/service/batch/types.QuotaShareCapacityLimit -- both fields are required on the real API. CapacityUnit keeps omitempty: this backend's own CreateQuotaShare/UpdateQuotaShare validation already rejects an empty capacityUnit (see quota_shares.go), so unlike MaxCapacity, no client can ever store one empty here. MaxCapacity has no such guard -- the real SDK client only rejects a nil pointer, not zero -- so it must never be dropped.

type QuotaSharePolicy added in v1.3.1

type QuotaSharePolicy struct {
	// Real AWS docs: "Currently, only FIFO is supported." Accepted and
	// stored as given, not validated against that single value, matching
	// this file's existing FairsharePolicy precedent of not validating
	// enum-shaped sibling fields.
	IdleResourceAssignmentStrategy string `json:"idleResourceAssignmentStrategy,omitempty"`
}

QuotaSharePolicy configures quota-share scheduling for a scheduling policy -- an alternative to FairsharePolicy, distinct from the separate top-level QuotaShare resource family (CreateQuotaShare etc., which associates a quota share with a job queue directly). See aws-sdk-go-v2/service/batch/types.QuotaSharePolicy.

type QuotaSharePreemptionConfiguration added in v1.2.0

type QuotaSharePreemptionConfiguration struct {
	InSharePreemption string `json:"inSharePreemption,omitempty"`
}

QuotaSharePreemptionConfiguration specifies the preemption behavior for jobs in a quota share. See aws-sdk-go-v2/service/batch/types.QuotaSharePreemptionConfiguration.

type QuotaShareResourceSharingConfiguration added in v1.2.0

type QuotaShareResourceSharingConfiguration struct {
	Strategy    string `json:"strategy,omitempty"`
	BorrowLimit int32  `json:"borrowLimit,omitempty"`
}

QuotaShareResourceSharingConfiguration specifies whether a quota share reserves, lends, or both lends and borrows idle compute capacity. See aws-sdk-go-v2/service/batch/types.QuotaShareResourceSharingConfiguration.

type RepositoryCredentials

type RepositoryCredentials struct {
	CredentialsParameter string `json:"credentialsParameter"`
}

RepositoryCredentials specifies credentials for a private container registry.

type ResourceRequirement

type ResourceRequirement struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

ResourceRequirement specifies a compute resource requirement (VCPU, MEMORY, or GPU).

type RetryStrategy

type RetryStrategy struct {
	EvaluateOnExit []EvaluateOnExit `json:"evaluateOnExit,omitempty"`
	Attempts       int32            `json:"attempts,omitempty"`
}

RetryStrategy configures automatic retry behavior for a job.

type RuntimePlatform

type RuntimePlatform struct {
	OperatingSystemFamily string `json:"operatingSystemFamily,omitempty"`
	CPUArchitecture       string `json:"cpuArchitecture,omitempty"`
}

RuntimePlatform specifies the OS family and CPU architecture for a job.

type SchedulingPolicy

type SchedulingPolicy struct {
	Tags             map[string]string `json:"tags"`
	FairsharePolicy  *FairsharePolicy  `json:"fairsharePolicy,omitempty"`
	QuotaSharePolicy *QuotaSharePolicy `json:"quotaSharePolicy,omitempty"`

	Arn  string `json:"arn"`
	Name string `json:"name"`
	// contains filtered or unexported fields
}

SchedulingPolicy represents a Batch scheduling policy.

type Secret

type Secret struct {
	Name      string `json:"name"`
	ValueFrom string `json:"valueFrom"`
}

Secret specifies a secret to expose to a container via environment variable.

type ServiceEnvironment

type ServiceEnvironment struct {
	Tags map[string]string `json:"tags"`

	ServiceEnvironmentName string `json:"serviceEnvironmentName"`
	ServiceEnvironmentArn  string `json:"serviceEnvironmentArn"`
	ServiceEnvironmentType string `json:"serviceEnvironmentType"`
	State                  string `json:"state"`
	Status                 string `json:"status"`
	// CapacityLimits is required by the real API on Create and in the
	// ServiceEnvironmentDetail response (see aws-sdk-go-v2/service/batch/
	// types.ServiceEnvironmentDetail.CapacityLimits); it was previously
	// missing entirely from this model.
	CapacityLimits []CapacityLimit `json:"capacityLimits"`
	// contains filtered or unexported fields
}

ServiceEnvironment represents a Batch service environment.

type ServiceEnvironmentOrder added in v1.2.0

type ServiceEnvironmentOrder struct {
	ServiceEnvironment string `json:"serviceEnvironment"`
	Order              int32  `json:"order"`
}

ServiceEnvironmentOrder pairs a service environment with its ordering in a job queue.

type ServiceJob

type ServiceJob struct {
	Tags                    map[string]string                  `json:"tags"`
	RetryStrategy           *ServiceJobRetryStrategy           `json:"retryStrategy,omitempty"`
	TimeoutConfig           *ServiceJobTimeout                 `json:"timeoutConfig,omitempty"`
	PreemptionConfiguration *ServiceJobPreemptionConfiguration `json:"preemptionConfiguration,omitempty"`
	StartedAt               *int64                             `json:"startedAt,omitempty"`
	StoppedAt               *int64                             `json:"stoppedAt,omitempty"`
	ScheduledAt             *int64                             `json:"scheduledAt,omitempty"`

	JobID                 string `json:"jobId"`
	JobArn                string `json:"jobArn"`
	JobName               string `json:"jobName"`
	JobQueue              string `json:"jobQueue"`
	ServiceJobType        string `json:"serviceJobType"`
	Status                string `json:"status"`
	StatusReason          string `json:"statusReason,omitempty"`
	ServiceRequestPayload string `json:"serviceRequestPayload,omitempty"`
	ShareIdentifier       string `json:"shareIdentifier,omitempty"`
	QuotaShareName        string `json:"quotaShareName,omitempty"`
	CreatedAt             int64  `json:"createdAt"`
	SchedulingPriority    int32  `json:"schedulingPriority,omitempty"`
	IsTerminated          bool   `json:"isTerminated"`
	// contains filtered or unexported fields
}

ServiceJob represents a Batch service job. Service jobs are submitted directly to a job queue (of type SAGEMAKER_TRAINING), not to a "ServiceEnvironment" reference on the job itself -- the service environment association lives on the JobQueue's ServiceEnvironmentOrder instead (see aws-sdk-go-v2/service/batch's SubmitServiceJobInput, which has no ServiceEnvironment field at all).

type ServiceJobEvaluateOnExit added in v1.2.0

type ServiceJobEvaluateOnExit struct {
	Action         string `json:"action"`
	OnStatusReason string `json:"onStatusReason,omitempty"`
}

ServiceJobEvaluateOnExit specifies a conditional retry rule for a service job.

type ServiceJobPreemptionConfiguration added in v1.3.1

type ServiceJobPreemptionConfiguration struct {
	// nil means "unset" (real AWS: "preempted jobs will be requeued an
	// unlimited number of times"), distinct from a present 0.
	PreemptionRetriesBeforeTermination *int32 `json:"preemptionRetriesBeforeTermination,omitempty"`
}

ServiceJobPreemptionConfiguration configures whether/how many times a preempted service job is retried before termination. See aws-sdk-go-v2/service/batch/types.ServiceJobPreemptionConfiguration. Request-settable and stored verbatim; distinct from ServiceJobPreemptionSummary (response-only, actual preemption history -- this backend never preempts service jobs, so that summary is never populated; see DescribeServiceJob's disclosed gap).

type ServiceJobRetryStrategy added in v1.2.0

type ServiceJobRetryStrategy struct {
	EvaluateOnExit []ServiceJobEvaluateOnExit `json:"evaluateOnExit,omitempty"`
	// Attempts is required whenever RetryStrategy is present -- the real SDK
	// client only rejects a nil pointer, not zero -- so it must never be
	// dropped even when explicitly 0.
	Attempts int32 `json:"attempts"`
}

ServiceJobRetryStrategy configures automatic retry behavior for a service job. See aws-sdk-go-v2/service/batch/types.ServiceJobRetryStrategy; this is a distinct (and structurally narrower) type from the regular Job's RetryStrategy -- it has no OnReason/OnExitCode matching.

type ServiceJobTimeout added in v1.2.0

type ServiceJobTimeout struct {
	AttemptDurationSeconds int32 `json:"attemptDurationSeconds,omitempty"`
}

ServiceJobTimeout configures the maximum duration for a service job attempt.

type Settings

type Settings struct {
	JanitorInterval   time.Duration `json:"janitor_interval"     env:"BATCH_JANITOR_INTERVAL"     default:"1m"  help:"Janitor tick interval."` //nolint:lll // Kong struct tag makes this line long
	InactiveJobDefTTL time.Duration ``                                                                                                         //nolint:lll // Kong struct tag makes this line long
	/* 139-byte string literal not displayed */
	CompletedJobTTL time.Duration `` //nolint:lll // Kong struct tag makes this line long
	/* 139-byte string literal not displayed */
}

Settings holds service-level configuration for the Batch backend. Fields are picked up by the Kong CLI parser when this struct is embedded in the root CLI command.

type ShareDistribution

type ShareDistribution struct {
	ShareIdentifier string  `json:"shareIdentifier"`
	WeightFactor    float32 `json:"weightFactor,omitempty"`
}

ShareDistribution specifies a fair-share weight for a share identifier.

type TaggedEntry added in v1.2.0

type TaggedEntry struct {
	Tags map[string]string
	ARN  string
}

TaggedEntry pairs a resource ARN with its tag map, for cross-service tag enumeration by the Resource Groups Tagging API (see cli.go's wireTaggingBatch).

type Tmpfs

type Tmpfs struct {
	ContainerPath string   `json:"containerPath"`
	MountOptions  []string `json:"mountOptions,omitempty"`
	Size          int32    `json:"size"`
}

Tmpfs specifies a tmpfs mount for a container.

type Ulimit

type Ulimit struct {
	Name      string `json:"name"`
	SoftLimit int32  `json:"softLimit"`
	HardLimit int32  `json:"hardLimit"`
}

Ulimit specifies a ulimit for a container.

type UpdatePolicy

type UpdatePolicy struct {
	TerminateJobsOnUpdate      bool  `json:"terminateJobsOnUpdate,omitempty"`
	JobExecutionTimeoutMinutes int64 `json:"jobExecutionTimeoutMinutes,omitempty"`
}

UpdatePolicy controls behaviour during in-place CE updates.

type Volume

type Volume struct {
	Host *HostVolume `json:"host,omitempty"`
	Name string      `json:"name"`
}

Volume specifies a volume available to containers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL