A new runner mode, floci.services.emrserverless.runner-mode=docker,
runs each Spark job run. Floci starts one container per run from the
release's EMR Serverless base image on Amazon ECR Public, and starts
spark-submit in local mode in it itself, since the image's own
entrypoint hands over to a script only EMR Serverless supplies. The
default, immediate, keeps today's behaviour.
A docker run is SCHEDULED while its image is pulled and its container
starts, RUNNING once the Spark driver runs, then SUCCESS when it exits
0 and FAILED otherwise, with the exit code in stateDetails, as the
user guide's job run states describe. CancelJobRun, or a BATCH run
passing its executionTimeoutMinutes, makes it CANCELLING until the
driver is stopped, then CANCELLED. A run left by a Floci restart is
FAILED once read.
Floci's shutdown and a state reset stop every driver, one whose image
is still being pulled as soon as its container is up, and a reset
raises a generation the runs' threads check, so none writes its run
back after the storage wipe. A driver a hard stop left running is
removed before this process starts one: driver containers carry the
deployment's owner label, as EC2's and ECS's do, and
reconcile-containers-on-startup turns the removal off, as theirs does,
for two Flocis sharing a daemon. A stop that comes after its run has
ended is dropped, and a cancel before a run starts is read from the
run's state. A driver is watched with a look at its container every
250 ms, as Batch's runner watches its jobs, so a run holds no Docker
connection while its driver runs; a run past its timeout is
CANCELLING while its driver is stopped.
spark-submit gets the entry point, its arguments and the
sparkSubmitParameters (split as a POSIX shell would), after the
spark-defaults of the application's runtimeConfiguration, or the
run's own in its applicationConfiguration, which replace the
application's whole classification ("Only the properties included in
StartJobRun is considered for this classification"); from
emr-spark-8.1.0 the two merge by property, the run's winning, as its
release notes say. S3A takes s3:// and s3a:// paths to Floci's S3 on
every release, with in-memory commit tracking, without which EMR's
committer loses every write; the Glue Data Catalog client goes to
Floci's Glue. The container gets a session for the run's execution
role and AWS_ENDPOINT_URL, as the other containers Floci launches do.
The image is public.ecr.aws/emr-serverless/spark/<release>:latest, or
spark4/ in place of spark/ for an emr-spark-* release, where ECR
Public keeps the AWS runtime for Apache Spark images. image-template
names another image, and docker-network the network.
Docker answers a stop of a container that has already exited with
HTTP 304, which ContainerLifecycleManager logged as a failed stop
after every run that ended by itself. It now counts as stopped, as a
304 on start already counts as started, and so does the runner's stop
for a cancel that finds the driver already exited.
A Hive run fails without running. Log destinations, retries and the
cancellation grace period are not emulated; the driver's output goes
to Floci's log.
Part of #6046 (REAL-2).