mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
* feat(emr): ListReleaseLabels, DescribeReleaseLabel and ListSupportedInstanceTypes None was served, so Terraform's aws_emr_release_labels and aws_emr_supported_instance_types data sources failed against Floci. A curated catalogue of EMR releases (emr-7.5.0, Floci's default, and emr-7.4.0, emr-6.15.0, emr-6.14.0 and emr-5.36.2) carries each release's applications and versions from the EMR Release Guide and its recent Amazon Linux releases, with common instance types and their EC2 sizes. The three actions filter and page it as the API documents, and answer InvalidRequestException for an unknown release, a bad token or an out-of-range MaxResults. A configured default release outside the catalogue is still listed. Closes #5734 * fix(emr): report EMR architecture values and match application versions without regard to case ListSupportedInstanceTypes returned the EC2 spellings x86_64 and arm64; the EMR model gives X86_64 and AARCH64 for Architecture. The ListReleaseLabels application filter matched the name without regard to case but not the version, so phoenix@4.14.3-hbase-1.4 missed emr-5.36.2. * refactor(emr): page the release catalogue with the shared Pagination ListReleaseLabels and ListSupportedInstanceTypes now page through core.common.Pagination, with the filters in the token namespace so a token replayed with other filters, or altered, is refused. DescribeReleaseLabel answers every application, as AWS reserves its MaxResults and NextToken. The EMR integration tests share one request helper.
97 lines
5.4 KiB
Markdown
97 lines
5.4 KiB
Markdown
# EMR
|
|
|
|
**Protocol:** JSON 1.1
|
|
**Endpoint:** `http://localhost:4566/`
|
|
**Target prefix:** `X-Amz-Target: ElasticMapReduce.*`
|
|
|
|
Floci emulates the Amazon EMR (Elastic MapReduce) management API. Clusters (job flows), instance groups and fleets, steps, security configurations, and tags are tracked in Floci's storage backend so the AWS CLI and SDK clients can drive the full cluster lifecycle locally. EMR does not launch real Hadoop/Spark clusters — clusters transition through their lifecycle states as a state machine.
|
|
|
|
## Supported Actions
|
|
|
|
<!-- floci:actions:start -->
|
|
| Action | Description |
|
|
| --- | --- |
|
|
| `RunJobFlow` | Creates a new cluster (job flow) and returns its `JobFlowId` |
|
|
| `DescribeCluster` | Returns the configuration and status of a cluster |
|
|
| `ListClusters` | Lists clusters, filterable by state and creation time |
|
|
| `TerminateJobFlows` | Terminates one or more clusters |
|
|
| `SetTerminationProtection` | Enables or disables termination protection |
|
|
| `SetVisibleToAllUsers` | Sets cluster visibility for the account |
|
|
| `SetKeepJobFlowAliveWhenNoSteps` | Controls auto-termination when steps complete |
|
|
| `SetUnhealthyNodeReplacement` | Toggles unhealthy-node replacement |
|
|
| `ModifyCluster` | Updates cluster-level settings such as step concurrency |
|
|
| `AddJobFlowSteps` | Adds one or more steps to a cluster |
|
|
| `DescribeStep` | Returns the detail and status of a single step |
|
|
| `ListSteps` | Lists the steps of a cluster, filterable by state |
|
|
| `CancelSteps` | Cancels pending steps |
|
|
| `AddInstanceGroups` | Adds instance groups to a running cluster |
|
|
| `ListInstanceGroups` | Lists the instance groups of a cluster |
|
|
| `AddInstanceFleet` | Adds an instance fleet to a cluster |
|
|
| `ListInstanceFleets` | Lists the instance fleets of a cluster |
|
|
| `ListInstances` | Lists the EC2 instances of a cluster |
|
|
| `CreateSecurityConfiguration` | Creates a named security configuration |
|
|
| `DescribeSecurityConfiguration` | Returns a security configuration |
|
|
| `DeleteSecurityConfiguration` | Deletes a security configuration |
|
|
| `ListSecurityConfigurations` | Lists all security configurations |
|
|
| `AddTags` | Adds tags to a cluster |
|
|
| `RemoveTags` | Removes tags from a cluster |
|
|
| `ModifyInstanceGroups` | Resizes or reconfigures instance groups |
|
|
| `ModifyInstanceFleet` | Changes an instance fleet's target capacities |
|
|
| `ListBootstrapActions` | Lists the bootstrap actions given to `RunJobFlow` |
|
|
| `PutManagedScalingPolicy` | Sets a cluster's managed scaling policy |
|
|
| `GetManagedScalingPolicy` | Returns a cluster's managed scaling policy |
|
|
| `RemoveManagedScalingPolicy` | Removes a cluster's managed scaling policy |
|
|
| `PutAutoTerminationPolicy` | Sets a cluster's idle timeout auto termination policy |
|
|
| `GetAutoTerminationPolicy` | Returns a cluster's auto termination policy |
|
|
| `RemoveAutoTerminationPolicy` | Removes a cluster's auto termination policy |
|
|
| `PutAutoScalingPolicy` | Attaches an automatic scaling policy to a core or task instance group |
|
|
| `RemoveAutoScalingPolicy` | Removes an instance group's automatic scaling policy |
|
|
| `ListReleaseLabels` | List release labels, newest first, by prefix or application; see [Release catalogue](#release-catalogue) |
|
|
| `DescribeReleaseLabel` | A release's applications and Amazon Linux releases (the latest release without a label) |
|
|
| `ListSupportedInstanceTypes` | The instance types a release supports, with vCPU, memory, storage and architecture |
|
|
| `GetBlockPublicAccessConfiguration` | Returns the account's block public access configuration for the Region |
|
|
| `PutBlockPublicAccessConfiguration` | Sets the account's block public access configuration for the Region |
|
|
<!-- floci:actions:end -->
|
|
|
|
## Release catalogue
|
|
|
|
`ListReleaseLabels`, `DescribeReleaseLabel` and `ListSupportedInstanceTypes` read a curated catalogue,
|
|
not AWS's full list: `emr-7.5.0` (Floci's default), `emr-7.4.0`, `emr-6.15.0`, `emr-6.14.0` and
|
|
`emr-5.36.2`. Each release's applications and versions come from its page in the Amazon EMR Release
|
|
Guide, with names lowercased and AWS's `-amzn-N` build suffix dropped, as the API reports them, and
|
|
its two most recent Amazon Linux releases. A `floci.services.emr.default-release-label` outside the
|
|
catalogue is still listed, with no applications.
|
|
|
|
`ListReleaseLabels` filters by `Prefix` (such as `emr-6`) and `Application` (`spark` or
|
|
`spark@3.4.1`, matched without regard to case) and pages with `MaxResults` (1 to 100) /
|
|
`NextToken`; a token only works with the filters it was issued for. `DescribeReleaseLabel` answers
|
|
every application at once, since AWS reserves its `MaxResults` and `NextToken` for future use.
|
|
`ListSupportedInstanceTypes` reports common families (c5, m5, m5d, m6g, r5, r6g) with
|
|
their EC2 sizes. An unknown release label, a bad token or an out-of-range `MaxResults` is
|
|
`InvalidRequestException`. `RunJobFlow` does not check its release label or instance types against
|
|
the catalogue.
|
|
|
|
## Example
|
|
|
|
```bash
|
|
export AWS_ENDPOINT_URL=http://localhost:4566
|
|
|
|
# Create a cluster
|
|
CLUSTER_ID=$(aws emr run-job-flow \
|
|
--name "demo-cluster" \
|
|
--release-label emr-7.0.0 \
|
|
--instances InstanceGroups='[{InstanceCount=1,InstanceGroupType=MASTER,InstanceType=m5.xlarge}]' \
|
|
--query 'JobFlowId' --output text)
|
|
|
|
# Inspect it
|
|
aws emr describe-cluster --cluster-id "$CLUSTER_ID"
|
|
aws emr list-clusters
|
|
|
|
# Add a step
|
|
aws emr add-steps --cluster-id "$CLUSTER_ID" \
|
|
--steps Type=CUSTOM_JAR,Name=demo,Jar=command-runner.jar,Args=[echo,hello]
|
|
|
|
# Terminate
|
|
aws emr terminate-clusters --cluster-ids "$CLUSTER_ID"
|
|
```
|