mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
A Task can now use the optimized EMR integrations the Step Functions guide lists: createCluster, setClusterTerminationProtection, terminateCluster, addStep, cancelStep, modifyInstanceFleetByName and modifyInstanceGroupByName, with .sync for createCluster, terminateCluster and addStep. Each calls Floci's EMR in the state machine's Region under the guide's field names: ClusterId for JobFlowIds or JobFlowId, a single Step or StepId, and the instance fleet or group found by name through ListInstanceFleets or ListInstanceGroups. They failed with "Unsupported resource" before. A .sync Task records TaskSubmitted with the call's result and polls DescribeCluster or DescribeStep under the Task's TimeoutSeconds and the execution's budget, as ecs:runTask.sync does. Its result is the describe response with the call's result after it, which is the createCluster.sync output recorded on AWS (Cluster, then ClusterId). A step that ends FAILED, CANCELLED or INTERRUPTED, or a cluster that terminates before WAITING, fails the Task with States.TaskFailed and the describe response as the cause. A wait that ends early cancels the step of an addStep.sync; a cluster is left running, as the guide says Step Functions does. An EMR error is named after the SDK exception class under EMR.: InvalidRequestException and InternalServerException keep their names, and any other code is EMR.AmazonElasticMapReduceException, as AWS reports a ValidationException. createCluster refuses KeepJobFlowAliveWhenNoSteps other than true and Steps, as the guide requires, with States.TaskFailed and the guide's wording for each rule. A Task without the ClusterId its API acts on, a cancelStep without a StepId and a ByName request without its name fail the same way. AddJobFlowSteps on an unknown cluster, or on one in another Region, now answers ValidationException "Specified job flow ID does not exist.", as AWS does: a botocore ClientError (raster-foundry/raster-foundry#352) and a CloudTrail record on AWS re:Post show it. It answered DescribeCluster's InvalidRequestException. That re:Post record is an addStep.sync failing on an unknown cluster with EMR.AmazonElasticMapReduceException, which addStep now reports as well. ModifyInstanceGroups and ModifyInstanceFleet on a terminated cluster, which modifyInstanceGroupByName and modifyInstanceFleetByName reach, now answer as AWS does too: ValidationException "An instance group may only be modified when the cluster is running or waiting." (hashicorp/terraform-provider-aws#1355 and hashicorp/terraform-provider-aws#9400) and InvalidRequestException "A job flow that is shutting down, terminated, or finished may not be modified." with ErrorCode INVALID_JOB_SHUT_DOWN (hashicorp/terraform-provider-aws#31375). Both answered InvalidRequestException "Cluster <id> is terminated.", which no AWS response shows, and EMR's error body now carries an error's extra members such as ErrorCode. TerminateJobFlows, the four Set* cluster setters and CancelSteps now refuse a request without a member their model requires (JobFlowIds and the setting, or StepIds) with AWS's framework ValidationException, as RunJobFlow does for Name. They read a missing list as empty and a missing setting as its default and answered success, which the setClusterTerminationProtection and terminateCluster integrations reached too. The "Member must not be null" violation is now one helper in SmithyValidationErrors. Part of #6046 (part 10).