Move `sagemaker` from NOT_COVERED to NAMESPACES in
regen_iam_request_resources.py, so SageMaker requests are checked on the
resources they name instead of `*`: a model, an endpoint configuration, an
endpoint, a training job or any other resource by its name, as
<type>/<name>, the ARN Floci mints, and a tag call on its ResourceArn.
CreateEndpoint and UpdateEndpoint are checked on the endpoint and the
endpoint configuration they name. No other namespace's rows change.
The reading of a member that names a type's variable gains its mirror: for
the type an operation is about, a name or id with a word of its own that the
variable's name ends in names it, also where a create leaves its id open, so
SageMaker's JobName names the inference recommendations job
(${InferenceRecommendationsJobName}) of CreateInferenceRecommendationsJob,
DescribeInferenceRecommendationsJob and StopInferenceRecommendationsJob.
Over the whole table it changes these three operations.
CreateEndpoint marked neither of its rows as what it makes, as the stem of
`endpoint-config` is `endpoint` too, so a tagged create needed
sagemaker:AddTags on the configuration it runs as well as on the endpoint.
A create's type is now matched by its whole name before its stem, so the
endpoint alone is made; over the whole table this changes CreateEndpoint.
Floci's shutdown stops every endpoint container, and nothing started
them again, so after a restart with persistent storage an endpoint
still reported InService while InvokeEndpoint failed with ModelError.
At startup, each endpoint that was InService or still Creating goes back
to Creating and is started again from its endpoint config and model, as
CreateEndpoint starts one, in the account it is stored under. It reports
InService once its container answers /ping, or Failed with the reason.
A Failed endpoint is left as it is, and one a crash left Deleting is
deleted.
Part of #5664.
ListModels ignored CreationTimeAfter and CreationTimeBefore and returned every model. Both now filter before paging, beside NameContains: CreationTimeAfter keeps the models created at or after its time and CreationTimeBefore those created before it, as the ListModels reference describes, and a bound that is not a number is a SerializationException. The page token records both bounds, so a token reused with a changed bound is refused with a ValidationException, as ListTrainingJobs does for its filters.
Closes#7627
* feat(sagemaker): support GPU-backed training jobs
ResourceConfig.InstanceType had no effect on the container Floci launched, so
a training job asking for ml.g5.xlarge ran on CPU. This maps the accelerator
half of an instance type onto a real device request, using the container GPU
primitive added in #3789.
On AWS the instance type *is* the hardware, so nothing is configurable. Floci
has one host with fixed cards, so serving a GPU instance type means
substituting a local device, and which devices may be lent out is a local
decision. The two halves are split accordingly:
- How many accelerators an ml.* type carries is a property of AWS, so it ships
as data in sagemaker/instance-type-catalog.yaml, mirroring how
Ec2InstanceTypeCatalog already carries vcpu and memory for EC2 types. It is
kept separate from that catalog because ml.* is its own namespace and must
never appear in DescribeInstanceTypes.
- Which of this machine's devices may be used is configuration, under
floci.services.sagemaker.gpu: enabled, mode and devices.
Nothing changes unless enabled is set. It defaults to false, so existing
deployments keep launching CPU-only containers, including for GPU instance
types.
mode exists because daemons disagree on the wire form. It defaults to cdi:
Podman resolves only CDI and accepts a count request while attaching no device
(containers/podman#22645), so preferring CDI turns a misconfiguration into a
refused start rather than a job that quietly trains on CPU. That principle
drives the failure cases too: an unlisted GPU-family type, too few allowed
devices, an explicit mode with no devices, and InstanceCount above one all
fail with a FailureReason instead of falling back to CPU. A job that reports
Completed after training on the wrong hardware leaves an artifact that looks
legitimate, which is worse than an error.
Only the accelerator is substituted. An instance type also implies vCPU and
memory, which this does not emulate, consistent with the rest of the codebase:
EC2 instance types are metadata for DescribeInstanceTypes and never size a
container, RDS records DBInstanceClass without acting on it, and Lambda, ECS
and Batch apply limits only where an API supplies an explicit number.
Endpoint hosting is unchanged and still CPU-only; the resolver is a separate
bean so it can be reused there in a follow-up.
* test(sagemaker): cover the GPU refusal paths and the hardware path
The GPU feature shipped with unit coverage on the resolver only, so nothing
exercised it through CreateTrainingJob. These add both halves.
SageMakerGpuIntegrationTest runs everywhere. Every path that refuses a request
raises inside SageMakerGpuResolver, before the runner asks the daemon for
anything, and the removeIfExists above it already swallows a missing daemon, so
an unlisted GPU family, InstanceCount above one, and cdi mode with no configured
devices all reach their verdict on a plain runner. A fourth case pins the
contract that enabling the feature leaves CPU instance types alone.
SageMakerGpuDockerIntegrationTest is opt-in behind -Dgpu.integration.enabled,
matching ContainerGpuDockerIntegrationTest, because it needs hardware no CI
runner has. Verified against an RTX 5060 Ti through Podman 5.8.2: the container
saw exactly the device named in gpu.devices and not the host's other card.
The assertion is the container's exit code. nvidia-smi output is redirected
rather than piped: a pipeline exits with the status of its last command, so
'nvidia-smi -L | tee' reports success even when nvidia-smi cannot reach the
driver, which would be this test passing on a CPU container.
* fix(sagemaker): package the instance type catalog in the native image
SageMakerInstanceTypeCatalog reads sagemaker/instance-type-catalog.yaml through
a constant, which Quarkus's static resource analysis cannot follow, and no glob
under quarkus.native.resources.includes matched it. The file was therefore left
out of the native image, so enabling floci.services.sagemaker.gpu.enabled there
would have failed every training job at catalog load with 'Missing catalog
resource sagemaker/instance-type-catalog.yaml'. Ec2InstanceTypeCatalog reads its
own catalog the same way and ec2/*.yaml was already listed for exactly this
reason.
Nothing caught it: JVM tests resolve the file from src/main/resources, and the
hardware verification ran a JVM-mode image, so the gap existed only in the
artifact neither exercised.
NativeImageResourceIncludesTest closes that gap the way
NativeImageRuntimeInitializationTest closes the Random-in-the-image-heap one, by
moving a native-only failure into ordinary CI. It pairs each resource-path
constant passed to getResourceAsStream with the includes globs and fails when
none matches, skipping the IAM catalog that application.yml already documents as
build-time only.
* refactor(sagemaker): match EC2's case handling for instance types
isAcceleratorFamily folded case while gpuCount did not, so ML.G5.XLARGE was
answered as a GPU family and then reported as missing from the catalog, pointing
the caller at the wrong fix.
Ec2InstanceTypeCatalog is the precedent and normalizes in neither position:
find() looks the type up exactly and familyOf() splits on the first dot without
folding. AWS instance types are exact tokens. The repo folds case where AWS
defines a value as case-insensitive, such as ACM domain names, regions and
content types, which an instance type is not.
Dropping the fold rather than adding one to gpuCount keeps both halves agreeing
and keeps the pair behaving like EC2's.
Also drops the @DisplayName from SageMakerGpuResolverTest. The suite does not
use them anywhere else; the method name carries the intent.
* docs(sagemaker): clarify GPU training device reuse
Implement the SageMaker control plane over the AWS JSON 1.1 protocol
(X-Amz-Target: SageMaker.*) plus the runtime invocation path:
- Models, endpoint configs, endpoints, training jobs, and tags with
AWS-shaped validation errors (ValidationException / ResourceInUse)
- CreateTrainingJob runs the training image as a real Docker container
using the /opt/ml contract: hyperparameters, resourceconfig and
inputdataconfig under /opt/ml/input/config, S3 channel data under
/opt/ml/input/data/<channel>, and /opt/ml/model uploaded back to S3
as model.tar.gz under the configured S3OutputPath
- CreateEndpoint hosts the model image as a long-lived container with
the serve command, /ping health checks, and ModelDataUrl artifacts
extracted into /opt/ml/model
- POST /endpoints/{name}/invocations proxies to the container and maps
model 5xx responses to ModelError (HTTP 424) like SageMaker Runtime
- Training container logs stream to CloudWatch Logs under
/aws/sagemaker/TrainingJobs
- Storage wired through StorageFactory with memory/persistent modes,
config in EmulatorConfig and both application.yml files
- Unit, integration, and Docker-gated integration tests plus a boto3
compatibility test; service and docs registered in the catalog