batchqueue

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package batchqueue resolves an AWS Batch job queue into the log sources of every job currently active in it — submitted, waiting, or running — tailing them all together and picking up newly submitted jobs as they arrive.

Unlike a single job or execution, a queue has no terminal state: work keeps arriving indefinitely, so Done is always nil. Discovery is driven by polling ListJobs across the active statuses and delegating each job id to a resolver/batch-style Resolver (WithBatchResolver), which handles the per-job/array-child log stream discovery and its own terminal polling.

Index

Constants

View Source
const Scheme = "batch-queue"

Scheme is the reference scheme this Resolver handles. A reference is a job queue name or ARN: "batch-queue:<queue>".

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	DescribeJobQueues(ctx context.Context, in *awsbatch.DescribeJobQueuesInput, optFns ...func(*awsbatch.Options)) (*awsbatch.DescribeJobQueuesOutput, error)
	ListJobs(ctx context.Context, in *awsbatch.ListJobsInput, optFns ...func(*awsbatch.Options)) (*awsbatch.ListJobsOutput, error)
}

API is the slice of the AWS Batch client this resolver needs. The real *batch.Client satisfies it.

type Option

type Option func(*Resolver)

Option configures a Resolver.

func WithBatchResolver

func WithBatchResolver(batch resolog.Resolver) Option

WithBatchResolver wires a resolver/batch-style delegate. Its reference is a Batch job id. Required: without it Resolve always errors, since this package only enumerates the queue, it does not resolve job log sources itself.

func WithPollInterval

func WithPollInterval(d time.Duration) Option

WithPollInterval sets how often the queue is re-swept for newly submitted jobs. Values <= 0 are ignored. Defaults to 3s.

type Resolver

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

Resolver resolves a Batch job queue into the log sources of its active jobs.

func New

func New(api API, opts ...Option) *Resolver

New builds a batchqueue Resolver from an AWS Batch client. Pass WithBatchResolver to actually enable Resolve.

func (*Resolver) List

func (r *Resolver) List(ctx context.Context, filter string) ([]resolog.ResourceRef, error)

List implements resolog.Lister, enumerating job queues whose name starts with filter (empty filter lists all). Resolve then takes one of the returned queue names.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, ref string) (resolog.Resolution, error)

Resolve implements resolog.Resolver. ref is a job queue name or ARN. It polls the queue's active jobs on an interval, delegating each newly seen job id to the configured batch resolver. Done is always nil: a queue is never terminal, so following runs until the caller cancels the context.

func (*Resolver) Scheme

func (r *Resolver) Scheme() string

Scheme implements resolog.Resolver.

Jump to

Keyboard shortcuts

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