Files
floci/docs
Priamo Germosen 591d5f533b feat(emr): run a cluster's bootstrap actions in the docker runner mode (#6878)
In the docker runner mode a cluster's BootstrapActions were stored and
listed but never run, so a step that needed what they install, such as
a Python library a PySpark step imports, failed where on AWS it would
run. Now a cluster with bootstrap actions is BOOTSTRAPPING while they
run, one after the other, in one container of the release's EMR
Serverless image, and that container is then kept as the image the
cluster's steps run in.

- Each action's script is read from Floci's S3 (s3n:// and s3a:// name
  the same bucket) and runs with its Args in /home/hadoop through
  docker exec, with the credentials of the cluster's instance profile
  in that exec's environment alone, so they never become part of the
  image.
- "Bootstrap actions execute as the Hadoop user by default. You can
  execute a bootstrap action with root privileges by using sudo", but
  the image has no sudo: an action runs as root, with a sudo that runs
  its command as it is, and what it leaves in /home/hadoop is the
  hadoop user's. The kept image runs as the user of the image the
  container ran, as the steps do, and the steps get it by its id, which
  runs as it is whatever image-registry-base Floci pulls images from.
- An action that exits with another code than 0 ends the cluster
  TERMINATED_WITH_ERRORS, with BOOTSTRAP_FAILURE and "On the master
  instance (<instance-id>), bootstrap action <n> returned a non-zero
  return code", as a real cluster gave it
  (hashicorp/terraform-provider-aws#4378) and the Management Guide
  quotes it. A script that cannot be read ends it the same way, in
  Floci's words; a bootstrap that cannot run, or that a restart cut
  short, with INTERNAL_ERROR. TerminateJobFlows stops it at once.
- With a LogUri, each action's stdout.gz and stderr.gz go under
  <LogUri>/<cluster-id>/node/<instance-id>/bootstrap-actions/<n>/, the
  instance the master as ListInstances gives it. An action's output
  goes to Floci's log line by line as it runs, and to those files
  gzipped as it arrives, through a file on disk, so however much it
  writes, Floci keeps no more than a line of it in memory.
- The image goes once the cluster has ended and its last step is done,
  and the cluster names it until it is gone, so a removal Docker
  refuses is tried again the next time the cluster is read; a reset
  removes them all, and the startup sweep, before any restarted cluster
  can move on, the ones of clusters that are gone or have ended.

ContainerExec gets an overload that sets an environment for one
command alone. What the bootstrap has in common with the Spark runner
and the rest of Floci is shared rather than copied:

- core.common.docker.ContainerLaunches: the runs in progress and their
  containers, which a stop, a reset or a shutdown removes; both EMR
  runners keep theirs in it.
- ContainerLifecycleManager.commit and removeImage.
- ContainerLogStreamer.consoleLines, a stream that logs each line as it
  arrives through the line logger its attach methods now share.
- S3Uri.isS3 and parseAnyScheme, which read s3n:// and s3a:// as s3://.
- EmrServerlessSparkRunner.putLogs, the runner's S3 log writing, which
  now reads each file from a stream.
2026-10-28 21:59:40 -05:00
..
2026-03-15 17:43:56 -05:00