Commit Graph
7 Commits
Author SHA1 Message Date
Priamo Germosen 15de90c3ff feat(stepfunctions): add the emr-serverless optimized integrations (#6386)
A Task can now use the six optimized EMR Serverless integrations the
Step Functions guide lists: createApplication, startApplication,
stopApplication, deleteApplication, startJobRun and cancelJobRun, each
request-response and .sync. Each calls Floci's EMR Serverless in the
state machine's Region. They failed with "Unsupported resource" before.

A Task names the API's members in PascalCase where the API writes them
in camelCase, so a request and a response are mapped against botocore's
EMR Serverless model, now vendored as aws/emr-serverless-shapes.json by
tools/aws/regen_emr_serverless_shapes.py: a structure's members are
renamed, a map keeps the keys the state machine wrote (tags,
InitialCapacity's DRIVER, a configuration's Properties such as
spark.executor.memory), and a member the model does not have is
dropped. A member, ApplicationId and JobRunId included, may be written
in either case. One the model has and Floci's request class lacks is
refused rather than dropped, and a test holds the classes to the model.
request_shapes.py can now keep output shapes for it. A request
without ClientToken gets a random one, as the SDK fills an idempotency
token in; the guide's examples leave it out.

The result is the API's response in PascalCase, or {"ApplicationId"}
where the API answers nothing, as the guide's table says. The guide
finds no difference between a .sync response and the API's, so a .sync
result is the starting call's own: state machines read a
createApplication.sync result's ApplicationId and a startJobRun.sync
result's JobRunId. A .sync Task records TaskSubmitted and polls
GetApplication or GetJobRun until the state the guide names, as the
elasticmapreduce ones do; a run that ends FAILED or CANCELLED, or an
application that can no longer get there, fails the Task with
States.TaskFailed and the describe response as the cause. A wait that
ends early cancels the run of a startJobRun.sync, stops the application
of a startApplication.sync and deletes the one a createApplication.sync
made, the call each integration's IAM policy grants beyond its own and
its read. EMR Serverless answering that the application or run is gone
or past undoing is logged and leaves the Task ending as it was; any
other failure is raised.

An EMR Serverless error keeps its code under EmrServerless., the
exception prefix the guide gives the service; no record shows the
optimized integration's. A Task without the ApplicationId, or a
cancelJobRun without the JobRunId, it acts on fails with
States.TaskFailed before EMR Serverless sees it.

CreateApplication now stores the configurations UpdateApplication
already did (runtime, monitoring, scheduler, disk encryption,
interactive, Identity Center and job-level cost allocation), and
ImageConfiguration keeps applicationLevelDigestResolution. Both were
dropped, from a Task and from the API alike. A runtime configuration
kept only its properties, lifted out of their member: Jackson bound the
properties member to the field of that name holding every member read.
It keeps its classification and properties now, on update as well.

GetApplication no longer returns the application's clientToken, which
its Application has no member for and which the .sync waits read. The
token stays with the stored application, which CreateApplication's
retries are matched on.

The .sync wait loop the elasticmapreduce integrations had is now shared
by both, as are their request and failure helpers, and the two EMR
Step Functions tests share their state machine helpers.

Part of #6046 (part 11).
2026-10-23 22:16:08 -05:00
Priamo Germosen 63d577a245 feat(emr-serverless): tag job runs and report their attempts (#6297)
TagResource, UntagResource and ListTagsForResource now take job run ARNs
(.../applications/<id>/jobruns/<id>), which the model's ResourceArn
allows ("the supported resources are Amazon EMR Serverless applications
and job runs"). They work on the tags StartJobRun stores, so GetJobRun
reports the current set, under the same rules as an application's: at
most 50 tags, no "aws:" prefix. An ARN must be the run's own, so one of
another application or account names nothing, and once an application
is deleted its runs' ARNs name nothing, as its own ARN already does. A
session ARN, which the pattern also allows, now answers
ResourceNotFoundException rather than ValidationException, as sessions
are not emulated.

ListJobRunAttempts (GET .../jobruns/{jobRunId}/attempts) and GetJobRun's
attempt parameter report attempts. Nothing runs, so no run fails and
none is retried: every run is one attempt, number 1, created and updated
with the run. GetJobRun, ListJobRuns and ListJobRunAttempts carry it.
GetJobRun with attempt 1 or none returns the run; another attempt
answers ResourceNotFoundException, in Floci's words, as no source shows
AWS's answer for an attempt a run never made, and leaves the run as it
was.

Also from the #6202 review:

- From release emr-7.11.0 a BATCH run's executionTimeoutMinutes must be
  1 to 10080. The model: "the maximum value is 10080 minutes (7 days)
  starting with Amazon EMR release 7.11. Setting a value of 0 to disable
  the timeout is no longer supported for BATCH mode job runs." Earlier
  releases and STREAMING runs keep 0 to 1,000,000. No source gives the
  error; ValidationException, in Floci's words. The check runs before
  auto-start, under the application's lock, so a refused run leaves the
  application as it was.
- ListJobRuns refuses a state or mode that does not exist and more than
  8 states, and ListApplications a state that does not exist and more
  than 7, with the framework ValidationException. A typo listed nothing
  before. ListApplications' maxResults outside 1 to 50 now answers the
  same framework message, joined with any states violation.
- EmrServerlessRegionIntegrationTest uses EmrServerlessRequests, which
  gains tagsPath, and pins a job run ARN across Regions;
  EmrServerlessTagIntegrationTest moves onto the same helpers.

The enum and range violations are now SmithyValidationErrors.notInEnum,
notAllInEnum and outOfRange, which EMR Serverless uses.

Part of #6046 (part 9).
2026-10-22 22:22:03 -05:00
Priamo Germosen 1f1e5db1bc feat(emr-serverless): start, get, list and cancel job runs (#6202)
Adds StartJobRun, GetJobRun, ListJobRuns and CancelJobRun under
/applications/{applicationId}/jobruns. Job runs are metadata only, like
Glue's: a run is RUNNING from submission and settles when read. With the
new floci.services.emrserverless.job-run-duration-seconds at its default
of 0, a BATCH run is SUCCESS as soon as it starts; a positive duration
keeps it RUNNING that long, and a run that would outlast its
executionTimeoutMinutes (720 when not given) is CANCELLED at the
timeout. A STREAMING run stays RUNNING until it is cancelled.

A run on a CREATED or STOPPED application starts it, as auto-start
defaults to on; with auto-start off the run is refused. clientToken is
the idempotency token: a retry returns the original run, and the same
token with another request answers ConflictException "Request did not
match the original". CancelJobRun on a finished run answers
ValidationException "Job run is not in a cancellable state". ListJobRuns
returns the newest runs first, filtered by states, creation time and
mode, and its nextToken resumes only the listing it came from. A run
needs a jobDriver that sets exactly one of sparkSubmit and hive, as
GetJobRun's JobRun always carries one, and tags are checked before
auto-start, so a refused run leaves the application as it was.
createdBy is the caller's ARN.

Application createdAt and updatedAt now go out as epoch seconds, the
restJson1 default for the model's Date shape, as job runs do. They were
epoch milliseconds, which the Java SDK reads as the year 58774 and
botocore refuses as out of range. Auto-start rewrites updatedAt, so a
run's own submission reached the bug. Applications persisted with
millisecond timestamps read back at the same instant.

Part of #6046 (part 8).
2026-10-22 07:24:33 -05:00
Jimmy Liu Jia 03f87285a0 fix(emr-serverless): retain deleted applications for waiters (#6103)
* fix(emr-serverless): retain deleted applications for waiters

* fix(emr-serverless): reject tag access after application deletion
2026-10-20 23:48:12 -04:00
Jimmy Liu Jia e14e5433ab fix(emr-serverless): isolate applications by request region (#6078) 2026-10-20 11:50:02 -04:00
David 5aad012e78 feat(emr-serverless): tag, untag and list tags for applications (#4667)
EMR Serverless had no tagging API: no TagHandler was registered for the
emr-serverless ARN service, so TagResource, UntagResource and
ListTagsForResource could not be routed, and a tagged
aws_emrserverless_application could not be planned.

Register an emr-serverless handler with the shared /tags dispatcher,
answering 200 as the model does, over the tags already stored on the
application. Validate keys and values, the user guide's 50 tag limit
and its reserved aws: prefix, refuse job run ARNs as not found, and
synchronize the application mutators so a tag write cannot lose a
concurrent update.

Closes #4662
2026-09-30 09:11:04 -04:00
NAMAN JAIN 8a673fc580 feat(emrserverless): support EMR Serverless applications (#2403)
* feat(emrserverless): add EMR Serverless application management emulator

This adds a full emulator for the EMR Serverless Application management plane,
allowing tools like Terraform to provision and manage EmrServerless applications.
Includes full CRUD operations, route collision handling, and integration tests.

* fix(emrserverless): disambiguate local endpoint routing using SigV4 auth header

* fix(emrserverless): resolve bot feedback on ARNs, idempotency, updates, and list controls

* fix(emrserverless): resolve bot feedback on idempotency races and dropped update fields

* fix(emrserverless): add jobLevelCostAllocationConfiguration to updates

* fix(emrserverless): retain nested configuration fields using dynamic properties

* fix(emrserverless): add required field validation and correct 404 status code

* docs(emrserverless): document unsupported tagging APIs

* fix(emrserverless): increase ListApplications maxResults limit to 100

* test(emrserverless): fix integration test assertions to align with required field validations and correct 404 status code

* fix(emrserverless): revert ListApplications maxResults limit to 50 to match AWS limits

* test(emrserverless): add validation tests for CreateApplication required fields
2026-08-20 00:08:21 -04:00