mirror of
https://github.com/floci-io/floci.git
synced 2026-12-05 02:58:00 -05:00
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).
96 lines
7.1 KiB
Markdown
96 lines
7.1 KiB
Markdown
# EMR Serverless
|
|
|
|
EMR Serverless is an AWS service that provides serverless data analytics environments. Floci provides an emulator for the management-plane API (REST JSON) which covers the lifecycle of an Application and of the job runs submitted to it.
|
|
|
|
## Configuration
|
|
|
|
| Key | Description | Default |
|
|
|-----|-------------|---------|
|
|
| `floci.emrserverless.enabled` | Whether the EMR Serverless API is enabled | `true` |
|
|
| `floci.emrserverless.port` | The port the service is exposed on | `4566` |
|
|
| `floci.services.emrserverless.job-run-duration-seconds` | How long a `BATCH` job run stays `RUNNING` before it succeeds; `0` makes it `SUCCESS` as soon as it starts | `0` |
|
|
|
|
## Endpoints
|
|
|
|
The emulator implements the standard AWS `emr-serverless` service endpoints:
|
|
|
|
* `POST /applications` (CreateApplication)
|
|
* `GET /applications` (ListApplications)
|
|
* `GET /applications/{applicationId}` (GetApplication)
|
|
* `PATCH /applications/{applicationId}` (UpdateApplication)
|
|
* `DELETE /applications/{applicationId}` (DeleteApplication)
|
|
* `POST /applications/{applicationId}/start` (StartApplication)
|
|
* `POST /applications/{applicationId}/stop` (StopApplication)
|
|
* `POST /applications/{applicationId}/jobruns` (StartJobRun)
|
|
* `GET /applications/{applicationId}/jobruns` (ListJobRuns)
|
|
* `GET /applications/{applicationId}/jobruns/{jobRunId}` (GetJobRun)
|
|
* `DELETE /applications/{applicationId}/jobruns/{jobRunId}` (CancelJobRun)
|
|
* `GET /applications/{applicationId}/jobruns/{jobRunId}/attempts` (ListJobRunAttempts)
|
|
* `POST /tags/{resourceArn}` (TagResource)
|
|
* `DELETE /tags/{resourceArn}?tagKeys=...` (UntagResource)
|
|
* `GET /tags/{resourceArn}` (ListTagsForResource)
|
|
|
|
The tagging operations work on application and job run ARNs, as `CreateApplication` and `StartJobRun`
|
|
return them (`arn:aws:emr-serverless:<region>:<account>:/applications/<id>` and
|
|
`.../applications/<id>/jobruns/<id>`). They share the tags those calls store, so `GetApplication` and
|
|
`GetJobRun` always report the current set. Following the EMR Serverless user guide, a resource holds
|
|
at most 50 tags, and `aws:` in any case is reserved as the prefix of a tag key or value. A session ARN
|
|
(`.../sessions/<id>`) answers `ResourceNotFoundException`, as sessions are not emulated. Once an
|
|
application is deleted, its ARN and its runs' ARNs answer `ResourceNotFoundException` too, while
|
|
`GetApplication` and `GetJobRun` still report them.
|
|
|
|
Applications, job runs, creation client tokens, and tags are scoped to the request's AWS Region. An
|
|
application or run created in one Region is not returned by list, get, or tag requests signed for
|
|
another.
|
|
|
|
`ListApplications` refuses a `states` filter naming a state that does not exist, or more than 7, and a
|
|
`maxResults` outside 1 to 50, with the `ValidationException` AWS's validation layer answers.
|
|
|
|
`DeleteApplication` leaves the application in `TERMINATED` state. `GetApplication` continues to
|
|
report that state so lifecycle waiters can observe it, while an unfiltered `ListApplications`
|
|
omits the terminated application. A terminated application cannot be started or stopped again.
|
|
|
|
## Job runs
|
|
|
|
Job runs are metadata only: nothing executes. A run follows the job run states and `GetJobRun`'s
|
|
response shape, and settles when it is read.
|
|
|
|
* **Lifecycle**: a run is `RUNNING` from the moment it is submitted. With the default
|
|
`job-run-duration-seconds` of `0`, a `BATCH` run is `SUCCESS` as soon as it starts; a positive
|
|
duration keeps it `RUNNING` that long. A run whose duration would pass its
|
|
`executionTimeoutMinutes` (720 when not given, as AWS reports it) is `CANCELLED` at the timeout.
|
|
A `STREAMING` run stays `RUNNING` until it is cancelled.
|
|
* **Auto-start**: a run submitted to a `CREATED` or `STOPPED` application starts the application,
|
|
as `autoStartConfiguration.enabled` defaults to `true`. With auto-start turned off, the run is
|
|
refused with `ValidationException` until the application is started. A run on a terminated
|
|
application is refused.
|
|
* **Idempotency**: `clientToken` is the idempotency token. Repeating a request with the same token
|
|
returns the original run; reusing the token with a different request answers `ConflictException`
|
|
(HTTP 409) "Request did not match the original".
|
|
* **Execution timeout**: `executionTimeoutMinutes` is 0 to 1,000,000, 0 meaning no timeout. From
|
|
release `emr-7.11.0`, a `BATCH` run's timeout must be 1 to 10080 minutes (7 days), as the model and
|
|
the 7.11.0 release notes say; a run outside that is refused with `ValidationException`.
|
|
* **CancelJobRun** moves a run that has not finished to `CANCELLED`. A finished run answers
|
|
`ValidationException` "Job run is not in a cancellable state".
|
|
* **ListJobRuns** returns the newest runs first, filtered by `states`, `createdAtAfter`,
|
|
`createdAtBefore` and `mode`, at most 50 per page. With several `states`, the runs are grouped by
|
|
state in the order the filter names them. A state or mode that does not exist, or more than 8
|
|
states, is refused with `ValidationException`. An unknown application has no runs. A `nextToken`
|
|
resumes only the listing it came from, with the same application and filters.
|
|
* **Attempts**: nothing runs, so no run fails and none is retried: every run is a single attempt,
|
|
number 1. `GetJobRun`, `ListJobRuns` and `ListJobRunAttempts` report it, with the run's own
|
|
creation and update times. `GetJobRun` with `attempt` 1, or without one, returns the run; an
|
|
`attempt` of 2 or more answers `ResourceNotFoundException`, and one below 1 or not an integer
|
|
`ValidationException`.
|
|
* `createdBy` is the caller's ARN, as `GetCallerIdentity` reports it. `releaseLabel` and
|
|
`networkConfiguration` come from the application.
|
|
|
|
## Limitations and Differences from AWS
|
|
|
|
* **Jobs do not execute**: `StartJobRun` records a job run and moves it through its states, but no Spark or Hive job runs.
|
|
* **Unsourced errors**: AWS documents neither the error for a run submitted to an application whose auto-start is off nor the one for a run on a terminated application; Floci answers both with `ValidationException`. The same holds for a `BATCH` timeout outside 1 to 10080 minutes on `emr-7.11.0` or later (`ValidationException`) and for `GetJobRun` naming an attempt a run never made (`ResourceNotFoundException`), both in Floci's own wording. A run needs a `jobDriver`, as every `JobRun` carries one, and `jobDriver` is a union, so a run without a driver, or with one that sets both `sparkSubmit` and `hive` or neither, is refused with `ValidationException` too, in Floci's own wording.
|
|
* **StopApplication with running jobs**: AWS requires running jobs to finish or be cancelled before an application stops. Floci does not enforce it; with the default duration of `0` no `BATCH` run is ever running.
|
|
* **Not emulated**: retries (`retryPolicy` is stored and returned, but no run fails, so none is retried), queuing (`QUEUED`), `totalResourceUtilization` and `billedResourceUtilization`, and `shutdownGracePeriodInSeconds` (accepted and ignored).
|
|
* **Instant Start/Stop**: Floci marks the application `STARTED` or `STOPPED` immediately without provisioning actual compute capacity in the background.
|
|
* **Data Plane**: Floci does not implement the data-plane API or any execution environments.
|