mirror of
https://github.com/floci-io/floci.git
synced 2026-12-03 02:07:58 -05:00
Three settings, all 0 by default, hold an EMR cluster and its steps in the states of the Management Guide's cluster lifecycle. cluster-startup-delay-seconds, declared before but read by nothing, keeps a new cluster STARTING for its first half and BOOTSTRAPPING for its second; step-duration-seconds keeps each step RUNNING; and cluster-termination-delay-seconds keeps a cluster TERMINATING before it is TERMINATED. A ready cluster is RUNNING while it runs its steps, in the order they were added and at most its StepConcurrencyLevel at a time, and WAITING once none is left; a transient one ends after them without waiting. ModifyCluster starts the steps a higher level makes room for. TerminateJobFlows cancels every step not yet completed, as its API reference says, and CancelSteps cancels a RUNNING step from release emr-5.28.0, which makes room for the next. A waiter or a step sensor now has something to wait for, and CancelSteps something to cancel. A new EmrClusterLifecycle works out when each change falls due from the settings and the times already recorded. Every call that reads a cluster first makes the changes due by then, and the service wakes at each cluster's next change, also after a restart, so the change's aws.emr event goes out when it happens, read or not; a wakeup sends its events on a thread of their own, in order, so a slow rule target holds up no cluster's change. A step's RUNNING now sends the step events table's event, and a WAITING cluster that runs added steps sends WAITING again once they are done. Every call that reads a cluster now holds the service and publishes its events after, as the four that changed one did, and answers from a copy made while it holds it. With the settings at 0, a cluster is ready, and its steps complete, before the call returns, as before; the step RUNNING events and the second WAITING are the only new events. ModifyInstanceGroups and ModifyInstanceFleet refuse a cluster that is not RUNNING or WAITING, a STARTING or BOOTSTRAPPING one included, as their AWS messages say, and AddJobFlowSteps and ModifyInstanceFleet a TERMINATING one, whose AWS message names a cluster "shutting down". AddInstanceFleet gives a TERMINATING one ModifyInstanceFleet's answer too, and AddInstanceGroups AddJobFlowSteps' ValidationException, since its model declares no InvalidRequestException; an AddJobFlowSteps with no steps leaves the cluster as it is. Part of #6046 (part 4).