batch

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchService

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

BatchService is the cloudmock implementation of the AWS Batch API.

func New

func New(accountID, region string) *BatchService

New returns a new BatchService for the given AWS account ID and region.

func (*BatchService) Actions

func (s *BatchService) Actions() []service.Action

Actions returns the list of Batch API actions supported by this service.

func (*BatchService) HandleRequest

func (s *BatchService) HandleRequest(ctx *service.RequestContext) (*service.Response, error)

HandleRequest routes an incoming Batch request to the appropriate handler. Batch uses REST-JSON protocol with path-based routing.

func (*BatchService) HealthCheck

func (s *BatchService) HealthCheck() error

HealthCheck always returns nil.

func (*BatchService) Name

func (s *BatchService) Name() string

Name returns the AWS service name used for routing.

type ComputeEnvironment

type ComputeEnvironment struct {
	ComputeEnvironmentName string
	ComputeEnvironmentArn  string
	Type                   string // MANAGED or UNMANAGED
	State                  string // ENABLED or DISABLED
	Status                 string
	StatusReason           string
	ComputeResources       *ComputeResource
	ServiceRole            string
	CreatedAt              time.Time
	// contains filtered or unexported fields
}

ComputeEnvironment represents a Batch compute environment.

type ComputeEnvironmentOrder

type ComputeEnvironmentOrder struct {
	ComputeEnvironment string
	Order              int
}

ComputeEnvironmentOrder defines the order of compute environments in a job queue.

type ComputeResource

type ComputeResource struct {
	Type             string
	MinvCpus         int
	MaxvCpus         int
	DesiredvCpus     int
	InstanceTypes    []string
	Subnets          []string
	SecurityGroupIds []string
	InstanceRole     string
}

ComputeResource describes the compute resources in a managed compute environment.

type ContainerDetail

type ContainerDetail struct {
	Image         string
	Vcpus         int
	Memory        int
	Command       []string
	ExitCode      *int
	Reason        string
	LogStreamName string
}

ContainerDetail describes a running container.

type ContainerProperties

type ContainerProperties struct {
	Image       string
	Vcpus       int
	Memory      int
	Command     []string
	JobRoleArn  string
	Environment []KeyValuePair
}

ContainerProperties describes the container for a job definition.

type FairsharePolicy

type FairsharePolicy struct {
	ComputeReservation int
	ShareDecaySeconds  int
	ShareDistributions []ShareDistribution
}

FairsharePolicy defines fair-share parameters for a scheduling policy.

type Job

type Job struct {
	JobName       string
	JobID         string
	JobArn        string
	JobQueue      string
	JobDefinition string
	Status        string
	StatusReason  string
	CreatedAt     time.Time
	StartedAt     *time.Time
	StoppedAt     *time.Time
	Container     *ContainerDetail
	RetryStrategy *RetryStrategy
	Timeout       *JobTimeout
	// contains filtered or unexported fields
}

Job represents a Batch job.

type JobDefinition

type JobDefinition struct {
	JobDefinitionName   string
	JobDefinitionArn    string
	Revision            int
	Type                string
	Status              string
	ContainerProperties *ContainerProperties
	RetryStrategy       *RetryStrategy
	Timeout             *JobTimeout
	CreatedAt           time.Time
}

JobDefinition represents a Batch job definition.

type JobQueue

type JobQueue struct {
	JobQueueName            string
	JobQueueArn             string
	State                   string
	Status                  string
	StatusReason            string
	Priority                int
	ComputeEnvironmentOrder []ComputeEnvironmentOrder
	CreatedAt               time.Time
}

JobQueue represents a Batch job queue.

type JobTimeout

type JobTimeout struct {
	AttemptDurationSeconds int
}

JobTimeout describes the timeout for a job.

type KeyValuePair

type KeyValuePair struct {
	Name  string
	Value string
}

KeyValuePair represents a key-value pair.

type RetryStrategy

type RetryStrategy struct {
	Attempts int
}

RetryStrategy describes the retry strategy for a job.

type SchedulingPolicy

type SchedulingPolicy struct {
	Arn             string
	Name            string
	FairsharePolicy *FairsharePolicy
	Tags            map[string]string
	CreatedAt       time.Time
}

SchedulingPolicy represents a Batch fair-share scheduling policy.

type ServiceLocator

type ServiceLocator interface {
	Lookup(name string) (interface {
		HandleRequest(ctx interface{}) (interface{}, error)
	}, error)
}

ServiceLocator resolves other services for cross-service integration.

type ShareDistribution

type ShareDistribution struct {
	ShareIdentifier string
	WeightFactor    float64
}

ShareDistribution defines a share for a single compute identifier.

type Store

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

Store manages Batch resources in memory.

func NewStore

func NewStore(accountID, region string) *Store

NewStore returns a new empty Batch Store.

func (*Store) CancelJob

func (s *Store) CancelJob(jobID, reason string) error

CancelJob cancels a job.

func (*Store) CreateComputeEnvironment

func (s *Store) CreateComputeEnvironment(name, ceType, state, serviceRole string, resources *ComputeResource) (*ComputeEnvironment, error)

CreateComputeEnvironment creates a compute environment.

func (*Store) CreateJobQueue

func (s *Store) CreateJobQueue(name, state string, priority int, computeEnvOrder []ComputeEnvironmentOrder) (*JobQueue, error)

CreateJobQueue creates a job queue.

func (*Store) CreateSchedulingPolicy

func (s *Store) CreateSchedulingPolicy(name string, fsp *FairsharePolicy, tags map[string]string) (*SchedulingPolicy, error)

CreateSchedulingPolicy creates a new scheduling policy.

func (*Store) DeleteComputeEnvironment

func (s *Store) DeleteComputeEnvironment(name string) bool

DeleteComputeEnvironment removes a compute environment.

func (*Store) DeleteJobQueue

func (s *Store) DeleteJobQueue(name string) bool

DeleteJobQueue removes a job queue.

func (*Store) DeleteSchedulingPolicy

func (s *Store) DeleteSchedulingPolicy(arn string) bool

DeleteSchedulingPolicy removes a scheduling policy.

func (*Store) DeregisterJobDefinition

func (s *Store) DeregisterJobDefinition(defArn string) bool

DeregisterJobDefinition deactivates a job definition.

func (*Store) DescribeSchedulingPolicies

func (s *Store) DescribeSchedulingPolicies(arns []string) []*SchedulingPolicy

DescribeSchedulingPolicies returns scheduling policies by ARN.

func (*Store) GetComputeEnvironment

func (s *Store) GetComputeEnvironment(name string) (*ComputeEnvironment, bool)

GetComputeEnvironment retrieves a compute environment.

func (*Store) GetComputeEnvironmentVCPUs

func (s *Store) GetComputeEnvironmentVCPUs(name string) (available, desired int, ok bool)

GetComputeEnvironmentVCPUs returns available and desired vCPUs for a compute environment.

func (*Store) GetJob

func (s *Store) GetJob(jobID string) (*Job, bool)

GetJob retrieves a job.

func (*Store) GetJobDefRevisions

func (s *Store) GetJobDefRevisions(name string) []*JobDefinition

GetJobDefRevisions returns all revisions for a given job definition name.

func (*Store) GetJobDefinition

func (s *Store) GetJobDefinition(nameOrArn string) (*JobDefinition, bool)

GetJobDefinition retrieves a job definition.

func (*Store) GetJobQueue

func (s *Store) GetJobQueue(name string) (*JobQueue, bool)

GetJobQueue retrieves a job queue.

func (*Store) ListComputeEnvironments

func (s *Store) ListComputeEnvironments() []*ComputeEnvironment

ListComputeEnvironments returns all compute environments.

func (*Store) ListJobDefinitions

func (s *Store) ListJobDefinitions() []*JobDefinition

ListJobDefinitions returns all job definitions.

func (*Store) ListJobQueues

func (s *Store) ListJobQueues() []*JobQueue

ListJobQueues returns all job queues.

func (*Store) ListJobs

func (s *Store) ListJobs(queue, status string) []*Job

ListJobs returns jobs, optionally filtered by queue and status.

func (*Store) ListTagsForResource

func (s *Store) ListTagsForResource(resourceARN string) map[string]string

ListTagsForResource returns all tags for a resource by ARN.

func (*Store) RegisterJobDefinition

func (s *Store) RegisterJobDefinition(name, jobType string, container *ContainerProperties, retry *RetryStrategy, timeout *JobTimeout) (*JobDefinition, error)

RegisterJobDefinition registers a new job definition.

func (*Store) SubmitJob

func (s *Store) SubmitJob(name, queue, jobDef string, container *ContainerDetail, retry *RetryStrategy, timeout *JobTimeout) (*Job, error)

SubmitJob submits a new job.

func (*Store) TagResource

func (s *Store) TagResource(resourceARN string, tags map[string]string)

TagResource applies tags to any resource by ARN.

func (*Store) TerminateJob

func (s *Store) TerminateJob(jobID, reason string) error

TerminateJob terminates a running job.

func (*Store) UntagResource

func (s *Store) UntagResource(resourceARN string, keys []string)

UntagResource removes tags from a resource by ARN.

func (*Store) UpdateComputeEnvironment

func (s *Store) UpdateComputeEnvironment(name, state, serviceRole string) (*ComputeEnvironment, bool)

UpdateComputeEnvironment updates a compute environment's state or service role.

func (*Store) UpdateJobQueue

func (s *Store) UpdateJobQueue(name, state string, priority int, ceOrder []ComputeEnvironmentOrder) (*JobQueue, bool)

UpdateJobQueue updates a job queue's state, priority, or compute environment order.

func (*Store) UpdateSchedulingPolicy

func (s *Store) UpdateSchedulingPolicy(arn string, fsp *FairsharePolicy) bool

UpdateSchedulingPolicy updates a scheduling policy's fair-share config.

Jump to

Keyboard shortcuts

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