yggdrasil.aws.batch.resource¶
resource ¶
AWS Batch runtime — resource + service.
When a job runs under AWS Batch the agent injects a well-known set of env vars (job id, attempt, queue, compute environment, array / multi-node topology). This module exposes them the same way the rest of the AWS surface is shaped:
- :class:
BatchService— the :class:~yggdrasil.aws.client.AWSServicebinding (service_name == "batch"), soBatchService.current()andclient.batchfollow the established singleton pattern instead of a free-floating dataclass. - :class:
AWSBatch— the :class:~yggdrasil.aws.client.AWSResourcecarrying the captured runtime context, a clickable :attr:explore_urlto the job in the Console, and theis_*flags. Reach it asclient.batchorAWSBatch.current().
:func:in_aws_environment is the lightweight, network-free "are we running
inside AWS?" probe (Batch / ECS / Fargate / Lambda — all set a tell-tale env
var); the S3 layer uses it to skip an egress proxy that doesn't apply in-VPC.
AWSBatch ¶
Bases: AWSResource
The AWS Batch runtime context this process is running under.
>>> AWSClient.current().batch.is_batch
True
>>> AWSClient.current().batch
AWSBatch(URL('https://eu-west-1.console.aws.amazon.com/batch/home?region=eu-west-1#jobs/detail/abc'))
Off-Batch every field is None and :attr:is_batch is False; the
captured env is snapshotted at construction so the resource is stable and
picklable.
in_aws_environment ¶
True when running inside AWS-managed compute (Batch / ECS / Fargate / Lambda). Pure env-var probe — no IMDS round trip.