Commit Graph
77 Commits
Author SHA1 Message Date
Hector Ventura 82c82ec553 fix(release): attach missing standalone binaries to an existing release (#9696)
2.4.0 and 2.5.0 shipped no standalone binaries, and nothing could add
them afterwards: re-running a release uses the tag's own workflow and
pushes the images again. Run by hand from main with a tag, release.yml
now builds the binaries that release lacks, or the ones named, from the
tag's source, and attaches them signed and attested as a tag run does.
It first verifies the release's sha256sums.txt against its cosign
bundle and the attached binaries against that file, then rewrites it to
cover every binary. A backfill never pushes or signs images and never
creates a release; tag runs build and publish as before.

Refs #8715
2026-11-28 22:25:00 -04:00
Vũ Thế Huy 9fe75bf985 fix(rds): check caller database permissions before retrying failed zero-ETL load (#9518)
Retrying a failed zero-ETL destination reloaded it through the admin connection without checking the caller, so a role that could not create the database still got it back. The retry now checks the caller's own privileges first: it goes ahead only for a superuser, or a role with CREATEDB that is a member of the database's owner, and otherwise refuses with PostgreSQL's own "permission denied to create database". The database name is quoted with PostgresWire.quoteLiteral. A nightly Docker check runs each condition against a real PostgreSQL 16, and both test classes share one fixture.
2026-11-27 11:55:27 -04:00
Priamo Germosen b8dcbeceb6 feat(rds): serve a DB instance at its own address in its VPC, on its Port (#9561)
With the new opt-in floci.services.rds.endpoints-in-vpc, a standalone DB
instance gets its own address in the subnet of its Availability Zone, as on
RDS, and serves the Port it was created with, or its engine's default, under
the name RDS gives it: <instance>.<identifier>.<region>.rds.<dnsSuffix>, with
one identifier per account and Region. Floci's DNS server answers the name
with the address, so two instances can both serve 5432.

A relay container at the address forwards each connection to the instance's
auth proxy, so IAM authentication, TLS and the master login are unchanged;
IAM tokens bind to the name and port the proxy binding publishes. The
address follows the instance through create, stop and start, a backend
started on retry, a move to another DB subnet group, a blue/green
switchover, delete, a failed create and a restart, and keeps its subnet and
VPC in use for DeleteSubnet and DeleteVpc.

VpcAddressRelays serves any endpoint this way next to VpcContainerLeases,
which now takes back a preferred address; RdsDnsRecordSource answers the
names, and AwsEndpoints builds them. Clusters and DB proxies keep the proxy
endpoint for now.

Refs #6273
2026-11-27 06:48:51 -04:00
Andre Kurait 09db5e5979 fix(route53): scope private DNS answers to the querying VPC (#9508)
For an identified workload, Route 53 and Cloud Map private DNS answers come only from zones associated with the querying VPC, account and Region; visibility is decided before the most specific zone is chosen, authoritative negative answers are kept, and conflicting runtime identities are refused. A caller with no known VPC keeps its private answers. EC2 and ECS register their guests' VPCs for the lifetime of the workload, revoking them on confirmed stop, and a terminating instance's IAM sessions and metadata tokens are revoked independently of Docker removal. The guest DNS checks run as nightly Docker checks.
2026-11-26 16:27:39 -04:00
Priamo Germosen ad51bc5ecc feat(emr): start a cluster's Trino with it and reach it from outside Docker (#9534)
A cluster with Floci's Trino now starts its primary node, and Trino on it,
in the background as it becomes ready, steps or none, the way an
application UI link already does; the cluster goes WAITING as before.

Clients outside the cluster reach Trino through Floci on a host of the
cluster's own, <cluster-id>.emr-trino.<Floci's host>, through the app UI
proxy: Trino's port is published on the primary node's loopback like the
node's web interfaces, the request keeps its Host, which Trino names its
next pages by, and goes on with X-Forwarded-Proto, which Trino honours
with http-server.process-forwarded. Until Trino answers the host gives a
503, which Trino's clients retry, and starts the node where it is not
running; an ending or ended cluster gives a 404. Floci's TLS certificate
names the new host label.
2026-11-26 12:49:29 -04:00
Priamo Germosen f2125d8908 fix(neptune): start clusters' containers again when Floci restarts (#9522)
Floci's shutdown stopped every Neptune cluster's proxy and graph
database container and nothing started them again, so after a restart
with persistent storage a cluster reported available with nothing
behind its port.

At startup each cluster now reports maintenance, and its instances
starting, with its proxy port held for it at once, so a cluster created
meanwhile is never handed it. Its container comes back in the
background on the volume its graph is kept in, in the engine the graph
was kept in, which the cluster's record now names, and its proxy
listens on its port again; the cluster and its instances then report
available. With no Docker daemon reachable they come back available
with no container, as a cluster created then does. A cluster whose
container or proxy does not start is left with none and its instances
failed, and is tried again at the next start. The restore runs in each
cluster's own account and Region, and marking the clusters calls no
Docker.

Floci now records which cluster holds each proxy port, so a cluster
whose stored port another cluster holds moves to a free one, its
instances with it, and one restored in the same process keeps its own. One recorded before its engine was kept is
taken to be in the configured one, and one recorded before its graph
was kept in a volume gets a volume, both kept before any Docker call.

A DeleteDBCluster while the restore is starting the cluster's container
leaves it deleting until the container has started, a second one too,
and the restore removes it then. A delete defers only while a restore
owns the cluster, which it does only once its marking is done, so one a
failed write left deleting is retried at once; one still deleting at the next start is removed in the
background. The delete, the restore and CreateDBInstance decide under a
per-cluster lock, and instance creation, deletion and the restore's
status writes under a per-instance one, taken first, so the restore
never puts back an instance deleted meanwhile. CreateDBInstance is
refused with InvalidDBClusterStateFault for a cluster that is not
available.
Shutdown now marks the container manager first, after which no
container starts. A container left under a cluster's name, by a Floci
that exited without stopping it, is now stopped with the same 30
seconds as at shutdown before its replacement starts, rather than
removed outright, so Gremlin Server saves its graph to the volume
first. The message refusing to delete a cluster with instances uses a
colon in place of its dash.

Closes #5664.
2026-11-26 10:08:52 -04:00
Priamo Germosen 63df4c12ee feat(emr): give a cluster's Trino its trino-connector catalogs and trino-config (#9523)
Each trino-connector-<catalog> classification now adds that catalog to the
cluster's Trino, of the connector of its name (delta_lake for delta,
raptor_legacy for raptor) unless it names its own. delta, hudi and iceberg
sit on the cluster's Hive metastore, or on Floci's Glue when the
classification says glue, and on Floci's S3, as hive already does; Delta
writes to S3 are on, as the Release Guide's Delta tutorial inserts into a
table there. trino-config goes into config.properties after Floci's, and
its http-server.http.port moves the coordinator, its readiness query and
the address the steps' trino-cli reaches.
2026-11-26 09:47:50 -04:00
Priamo Germosen 6a3874a3e2 fix(neptune): keep each cluster's graph in a Docker volume of its own (#9505)
A Neptune cluster's graph lived only in its container: Gremlin Server's
TinkerGraph kept it in memory, and Neo4j in the unnamed volume its image
declares for /data. Removing the container, as Floci's shutdown does,
lost it, so a cluster could never be started again with its graph.

When Neptune's records are kept (its own storage mode, or the global
one, is persistent, hybrid or wal), a new cluster now gets a volume ID,
kept in its record, and its container mounts floci-aws-neptune-<id>, or
binds <host-path>/neptune/<id> when the host persistent path is an
absolute path. Neo4j keeps its data directory there. Gremlin Server's
image has its data directory there, and Floci writes the image's
TinkerGraph properties before the container starts so the graph is
saved to it when the server stops and loaded from it when it starts.
Under the host path Gremlin Server runs as root, since the directory
belongs to whoever created it rather than to the image's gremlin user.
An image laid out otherwise keeps its graph in memory, with a warning.
A container now has 30 seconds to stop before Docker kills it, as
Gremlin Server saves its graph a few seconds after the stop signal.

DeleteDBCluster removes the volume as the storage policy says, under
the storage mode Neptune's records are kept in, its own or the global
one; a create that fails removes it whatever the policy. A cluster created
again under a deleted one's identifier starts on a new, empty volume.

Starting the clusters' containers again on these volumes when Floci
restarts comes next.

Part of #5664.
2026-11-26 08:19:46 -04:00
Niels Kootstra 370b49861a fix(ec2): apply the shutdown behavior when an instance's guest powers itself off (#9475)
EC2 watches each instance container once it runs, and an exit Floci did not cause applies the instance's InstanceInitiatedShutdownBehavior: StopInstances by default, TerminateInstances for terminate, with the state reason Client.InstanceInitiatedShutdown. The behavior comes from RunInstances, its launch template or ModifyInstanceAttribute, is set before any container starts, is reported by DescribeInstanceAttribute, and must be stop or terminate. Reboots queue behind the container's other lifecycle operations, and the wait-stream exit watcher moves from Lambda to core.common.docker.

Fixes #9385
2026-11-26 01:14:24 -04:00
Priamo Germosen 4792c97902 fix(docdb): start clusters' containers again when Floci restarts (#9498)
Floci's shutdown removed every DocumentDB cluster's MongoDB container
and nothing started them again, so after a restart with persistent
storage a cluster reported available with nothing behind its endpoint.

At startup each cluster now reports maintenance, and its instances
starting, and its container comes back in the background on the volume
the cluster's data is kept in, with the master password the data was
set up with. Floci now keeps that password in the cluster's record,
never returned by the API, since a snapshot authenticates with it. The
cluster and its instances then report the new container's port and
available. With no Docker daemon reachable they come back available
with no container, as a cluster created then does. A cluster whose
container does not start is left with none and its instances failed,
and is tried again at the next start. The restore runs in each
cluster's own account and Region.

A cluster recorded before Floci kept the master password reads it from
the container it left, if one is there, and keeps it in its record
before that container is replaced; with none left it cannot be started,
and the restore says to create it again. One recorded before
its data was kept in a volume gets a new volume, kept in its record
before any Docker call.

Marking the clusters calls no Docker; the containers, and the removal
of a delete Floci did not live to finish, are all in the background.

A DeleteDBCluster during the restore leaves the cluster deleting until
its container has started, a second one too, and the restore removes it
then; one still deleting at the next start is removed then. The restore
applies its result only to the cluster it marked. CreateDBInstance is
refused with InvalidDBClusterStateFault for a cluster that is not
available, as RDS refuses it, so a deferred delete leaves no instance
behind. Shutdown now marks the
container manager first, after which no container starts, and a start
it overtakes removes its container.

Part of #5664.
2026-11-26 01:01:13 -04:00
Priamo GermosenandJames McMahon 05b77db069 feat(ssm): support agent-backed Session Manager sessions (#9492)
Session Manager for Linux EC2 guests running the stock SSM agent and the Session Manager plugin: interactive shells, SSH and port forwarding, with StartSession, ResumeSession, TerminateSession, DescribeSessions and GetConnectionStatus, and session document validation. Direct SendCommand execution on instances without the agent is unchanged.

StartSession and GetConnectionStatus are checked on the EC2 target, and StartSession on the selected or default session document, read from the Session Manager guide and API reference pages vendored in tools/aws/sources/ssm-session-permissions.json.

Replaces #9366, rebased onto main with the generated IAM table refreshed. On top of it, GetConnectionStatus echoes the Target it was asked about, as AWS answers. The agent's OpenDataChannel is checked on the session ARN, as the client's is, so a deny on one session reaches the instance role. Starting a session deletes the account's history older than the 30 days DescribeSessions lists.

Closes #9365

Co-authored-by: James McMahon <james@jamesmcmahon.co.uk>
2026-11-26 00:04:57 -04:00
Priamo Germosen c829b397ab fix(mwaa): start environments again when Floci restarts (#9466)
Floci's shutdown removed every MWAA environment's Postgres and Airflow
containers, with their volumes, and nothing started them again, so after
a restart with persistent storage an environment reported AVAILABLE with
nothing behind its webserver URL.

Shutdown now keeps the volumes while the environments are stored to come
back, and Floci keeps the secrets the metadata database was set up with
(its password, the Fernet key and the admin password) in a store of its
own, which GetEnvironment never returns. Shutdown removes containers by
the IDs Floci holds and under the environments' names, so none outlives
it, the ones a restore had not reached yet included. At startup each
environment reports MAINTENANCE, or CREATING while it was being created,
and its containers come back in the background. Containers that outlived
Floci are taken over, their secrets read back from the Airflow
container. Otherwise new ones start on the kept volumes with the kept
secrets, so DAG runs, connections and variables are back, and the
startup script and requirements.txt run as at creation. Containers and
volumes named before the floci-aws- prefix are found too. The web proxy
comes back on the port WebserverUrl names, or on a new one when that
port is taken. The first DAG sync after the restore compares the DAG
volume with S3, so a DAG deleted while Floci was stopped is removed; the
sync reads every page of the S3 listing, so no DAG past the first
thousand reads as deleted. The readiness poller reports the environment
AVAILABLE once Airflow is healthy, or UNAVAILABLE when a container exits
first; one whose containers do not start is UNAVAILABLE, and tried again
at the next start.

An environment stored before Floci kept the secrets gets them back from
a container left under its name, or, with none left, new ones, as its
volumes went at the shutdown then; one whose volumes are still there is
left UNAVAILABLE rather than started on new ones. Secrets found or given
are kept before anything starts. When Docker cannot say which containers
or volumes are left, the environment's restore fails, removing nothing.

A DeleteEnvironment during the restore leaves the environment DELETING
until its containers have started, and the restore then removes it; one
still DELETING at the next start is removed then. A start that shutdown
overtakes removes its containers. A new environment starts on empty
volumes, so it never inherits a database set up with other secrets.

Part of #5664.
2026-11-25 17:23:27 -04:00
Priamo Germosen c843dcbdfc fix(opensearch): start domain containers again when Floci restarts (#9434)
Floci's shutdown removes every OpenSearch domain's container, and
nothing started them again, so after a restart with persistent storage
a domain reported an endpoint nothing answered on.

At startup, each domain goes back to Processing, and its container
comes back in the background. A container that outlived Floci, kept
running across the shutdown or left behind by a killed Floci, is kept:
found by the container ID the record names, started again if it
stopped, and its host port reserved again. Otherwise the domain gets a
new container on the data it kept, so its indices are back, and the
readiness poller reports it ready once it answers. A domain started
again keeps the storage its record names, whatever the data-volume
setting says then: the operator's volume, or bind-mounted directory,
whose path the record now keeps, or its own Floci-managed volume. With no Docker
daemon reachable, a domain has no container, as one created then has.

A domain deleted during its restore reads Deleted, keeps its name, and
is removed with its container and data once the restore's start is
through; one still Deleted at the next start is removed then. Each
removal is confirmed with Docker, and deleting again a domain whose
delete Docker kept the container of confirms it the same way, one
retry at a time, on the record still stored. A start that shutdown overtakes
removes its container.

Part of #5664.
2026-11-25 10:05:46 -04:00
Priamo Germosen 732001a90f fix(kinesisanalytics): start Flink clusters again when Floci restarts (#9390)
Floci's shutdown removes every application's Flink cluster, and nothing
started them again, so after a restart with persistent storage an
application still reported RUNNING with no cluster and no job behind
it.

At startup, each application that was RUNNING or still STARTING goes
back to STARTING, and its cluster starts in the background. A cluster
that outlived Floci is kept when its JobManager, TaskManager and job
still run. Otherwise what survives of it is removed, under the current
or the old floci- names, and the application gets a new cluster, as
StartApplication starts one, in the application's own account, and the
readiness poller runs its job afresh and reports it RUNNING. An
application whose cluster cannot be started goes back to READY, from
which StartApplication starts it again. An application stopped while
its restore is starting the cluster is STOPPING, as AWS reports a stop
in progress, until the restore has removed that cluster by its
containers' IDs, and READY then. StartApplication and DeleteApplication
refuse it meanwhile, so no second start runs under the cluster's names.
One still STOPPING at the next start has what survives of its cluster
removed before it turns READY. Each removal is confirmed with Docker:
while Docker keeps the cluster, the application stays STOPPING and the
cluster stays named and tracked, for shutdown and the next start.
Records stored under the keys of older builds move onto their current
keys first, so no application is restored twice. A start that shutdown
overtakes removes its containers.

Part of #5664.
2026-11-25 06:40:37 -04:00
Hector Ventura 0b232e7f06 test: run the Docker end-to-end classes nightly and on pull requests that change their service (#9310) 2026-11-24 21:04:04 -04:00
Priamo Germosen 8dd85097f0 feat(emr): run Trino on a docker cluster whose Applications name it (#9382)
A cluster whose Applications named Trino ran none, as no AWS image
carries it. With floci.services.emr.trino.enabled on, off by default, a
docker cluster that installs Trino now runs its coordinator, and its
steps run EMR's trino-cli against it.

- The coordinator, which runs the queries too, runs on the cluster's
  primary node, in a container of its own that shares the node's
  network: from the Trino project's image of the version the release's
  page in the Release Guide gives (trino.image, trinodb/trino:%s, 446
  for emr-7.5.0), with trino.memory-mb of memory (2048), on port 8889,
  EMR's.
- EMR installs hive-client and hcatalog-server with Trino, so the
  cluster's image has Hive and its primary node runs Hive's metastore
  service. Trino's hive catalog is that metastore, or Floci's Glue Data
  Catalog when trino-connector-hive sets hive.metastore to glue, the
  classification's other properties after Floci's. Trino reaches S3 and
  Glue with a session for the cluster's instance profile's role, as the
  metastore does.
- The cluster's image gets Trino's CLI from Trino's image, and a
  trino-cli that runs it on the image's Java 17 against the coordinator,
  whose address the steps get, unless a step names a server of its own.
- The cluster's first step starts Trino with the HDFS and waits for it.
  It goes before the primary node when the cluster ends, on a reset and
  on a shutdown, and one an earlier Floci left goes when the service
  starts.
- A nightly check runs trino-cli steps on a cluster with the metastore
  and on one with Glue. It joins the docker-runner group, whose budget
  grows by its 24 minutes, and the prefetch pulls its Trino image.
2026-11-24 17:17:07 -04:00
Priamo Germosen 4a9ae4a569 fix(amazonmq): start broker containers again when Floci restarts (#9377)
Floci's shutdown removes every broker container, and nothing started
them again, so after a restart with persistent storage a broker still
reported RUNNING while nothing answered on its endpoints. A new
container would not have helped either: RabbitMQ keeps its data under
the node name, which defaults to the hostname Docker sets to the
container id, so a new container on the same volume started an empty
node without the broker's users.

Broker containers now run as the fixed node name rabbit@localhost. At
startup, each broker that was RUNNING or still starting goes back to
CREATION_IN_PROGRESS, and its container starts in the background. A
container that outlived Floci is kept when it still answers. Otherwise
the broker gets a new container on its volume, without seeding the
admin user, whose password is never stored, and on the host ports it
had when they are free. The readiness poller reports it RUNNING once
the console it probed answers.

A broker from before fixed node names with no surviving container is
reported CREATION_FAILED. One whose restore fails is reported
CREATION_FAILED and tried again at the next start, one CreateBroker
failed for is left as it is, and one a crash left DELETION_IN_PROGRESS
is deleted.

Part of #5664.
2026-11-24 16:17:21 -04:00
Hector Ventura 73aa27f2aa test: run the plain test classes four at a time in CI (#9311) 2026-11-23 22:41:25 -04:00
Priamo Germosen 29e262e783 feat(emr-containers): run a managed endpoint's Jupyter Enterprise Gateway (#9232)
An EMR on EKS managed endpoint ran nothing: it was ACTIVE at once with no
serverUrl, so no Jupyter client could start a kernel on it, and its
session tokens opened nothing.

- With runner-mode docker, an endpoint runs a Jupyter Enterprise Gateway,
  which "provides the remote kernel lifecycle management capability that
  interactive clients need", in a container of its release's
  notebook-spark image on Amazon ECR Public, the base image of
  interactive endpoints. That image holds jupyter_server and ipykernel but
  no Enterprise Gateway, so a program of Floci's own serves the gateway's
  kernels API on jupyter_server, passing a kernel the KERNEL_ variables
  of its start request's env, as Jupyter Enterprise Gateway does.
- Its kernels are the image's python3, and spark-python-kubernetes, whose
  spark and sc are a Spark session in Spark's local mode on Floci's S3,
  with the endpoint's execution role, KERNEL_EXTRA_SPARK_OPTS going to
  its spark-submit.
- The endpoint is CREATING until the gateway answers, then ACTIVE with
  its serverUrl and the guide's "Endpoint created successfully. It took
  m Minutes s Seconds". DeleteManagedEndpoint makes it TERMINATING until
  the gateway has stopped. A gateway that fails, and one a restart left,
  end it TERMINATED_WITH_ERRORS with INTERNAL_ERROR.
- serverUrl is a path of the endpoint's own on Floci's port. A request
  there goes on to the gateway, its kernels' WebSocket tunnelled, when it
  carries a live token GetManagedEndpointSessionCredentials gave for that
  endpoint, as a token parameter or an Authorization: token header, as
  Jupyter Enterprise Gateway 2.6.0 takes one; any other gets that
  gateway's 401 {"reason": "Unauthorized", "message": ""}.
- SessionServers, which runs EMR Serverless's and EMR's Spark Connect
  servers and keeps their tokens, runs the gateways too, a token given
  for one endpoint reaching no other. CloudFront's WebSocket splice moves
  to WebSocketUpgrades, which the gateway's tunnel shares.
- gateway-image-template replaces the notebook image's registry.
2026-11-23 06:39:56 -04:00
Alexy Grabov 624f1304d2 fix(ec2): preserve established host connections on ingress revoke (#9186)
With security-group enforcement on, revoking the last world-open ingress rule closes the relay's host listener at once and keeps the connections it already accepted, as AWS keeps tracked connections. When the instance's egress allows TCP to every address and port in the family the relay uses to reach the guest, AWS does not track those flows, so the revoke removes the relay and closes them immediately. A listener that cannot be closed falls back to removing the relay, one instance's failure no longer skips the group's other instances, and stop or terminate removes any draining relay. Ec2PublishedConnectionNightlyIntegrationTest covers both cases.
2026-11-22 14:53:21 -04:00
Priamo Germosen 84cbee7d6f feat(emr-containers): run a job run's Spark job in a container (#9203)
An EMR on EKS job run ran nothing: it was COMPLETED at once, or RUNNING
on a timer and then COMPLETED, whatever its Spark job would have done.

- With floci.services.emrcontainers.runner-mode set to docker, a run
  runs its Spark job in a container of its release's EMR on EKS base
  image on Amazon ECR Public, or of its custom image: a
  sparkSubmitJobDriver's spark-submit, or a sparkSqlJobDriver's
  spark-sql with its entry point as the file it runs, with the
  spark-defaults of its configurationOverrides and its execution role's
  credentials, on Floci's S3.
- The release label names the image's repository and tag, as the
  development guide's release notes give each release's "Container
  image tag": emr-7.2.0-20240610 runs emr-7.2.0:20240610. The base
  image's spark-defaults.conf runs a driver in Kubernetes' cluster
  mode, so the driver runs in client mode, its executors with it.
- A run is SUBMITTED while its container starts, RUNNING once its
  driver runs, and COMPLETED or FAILED as the driver exits, a failed
  driver with AWS's USER_ERROR and "Jobrun failed. Main Spark container
  terminated with errors. ...". A container that cannot start, a job
  driver without an entry point, and a run a restart left running fail
  with the development guide's INTERNAL_ERROR and VALIDATION_ERROR
  answers.
- CancelJobRun makes a running run CANCEL_PENDING until its driver is
  stopped, then CANCELLED.
- A run holds its virtual cluster's running slot from its submission
  until its driver ends, counting as concurrent, not queued, and the
  slot then goes to the queue. A run that cannot be handed to a thread
  fails and frees its slot, and a leftover driver of a run found failed
  is removed.
- The immediate runner mode, the default, is unchanged.
2026-11-22 09:33:41 -04:00
Hector Ventura 030ba3d72b chore(ci): run the EMR Docker runner test nightly, beside the cluster shrink check (#8957)
EmrDockerRunnerDockerIntegrationTest pulls a 3.5 GB image and took about 640 s of a passing pull request shard, so after #8903 moved its cluster shrink scenario to the nightly checks, the rest of the class follows as EmrDockerRunnerNightlyIntegrationTest. partition.sh no longer weighs it: SLOW_CLASSES comes from PARTITION_SLOW_CLASSES, empty by default, and test_partition.py passes its own. The standard nightly group has no room for it (339 of its 359 minutes), so the cluster-shrink group becomes docker-runner, with both classes in 42 minutes of bounds in a 62-minute job. On a pull request, the nightly checks now run only the nightly classes it adds or changes, or all of them when it changes the workflow.
2026-11-19 11:22:50 -04:00
Hector Ventura b9ebbe0a42 feat(docker): count open Docker streams per service and add a saturation harness (#8953)
* feat(docker): count open Docker streams per service and add a saturation harness
* fix(docker): match container routes at the start of the path, and tidy the harness
* test(docker): drop the saturation harness's quiet-stream sleep
2026-11-19 10:14:01 -04:00
Andre Kurait fb59000838 test(emr): move the cluster shrink scenario to nightly checks (#8903)
* test(emr): move the cluster shrink scenario to nightly checks
2026-11-19 06:50:46 -04:00
Priamo Germosen 3ffec01a76 feat(emr-serverless): open the live Spark UI from dashboard links (#8890)
With runner-mode docker, GetDashboardForJobRun's link for a Spark run's
attempt that has not ended now opens its driver's Spark UI for real, and
GetResourceDashboard's link does the same for a session's Spark Connect
server, as "For jobs in a running state, the application UI is a live
user interface such as the Spark or Tez web UI" and "While a session is
active, the URL opens the live Apache Spark UI".

Each link opens on a host of its own,
<secret>-4040.emr-serverless-ui.<Floci's host>, through the application
UI proxy EMR's on-cluster UIs use. That proxy moves to core.common
(AppUiProxy, AppUiRoutes, AppUiRoute, AppUiHost), and each service
registers the label its hosts are under. The runner turns the driver's
UI on for every EMR Serverless Spark run, as the release's image turns
it off, publishes port 4040 on the Docker host's loopback interface, and
keeps where Floci reaches it while the container runs.

A run whose logs are not kept in managed storage gets no live UI, as
with logs in S3 alone the application UI is "Not supported". A Hive
run, a run or session that has ended, and every link in the immediate
mode still open Floci's own page, which now says whether the attempt's
logs are in managed storage.
2026-11-18 15:41:25 -04:00
Priamo Germosen 4b342dad3f feat(emr): open a cluster's on-cluster application UIs for real in the docker runner mode (#8773)
With runner-mode docker, GetOnClusterAppUIPresignedURL now opens the
interfaces that run on the cluster's primary node for real: its
ResourceManager, an application master through the ResourceManager's
web proxy, its MapReduce JobHistory server, and the NodeManager of a
primary node that works.

Each opens on a host of its own, as AWS's application UIs do under
emrappui-prod.<region>.amazonaws.com, which are on the Public Suffix
List: http://<secret>-<port>.emrappui.<Floci's host and port>/, the
secret 26 random base32 characters only the link holds, so the host is
the link's authority, as the interface takes no AWS credentials.
EmrAppUiProxy, a Vert.x route ahead of the REST layer, sends a request
to that host on to the node's port, which the primary node publishes on
the host's loopback interface (Floci in a container joins the cluster's
network instead). It asks the interface under the browser's host, so
the links the interface writes itself are the browser's, and makes each
link the node's daemons write to one another by the node's name a link
to that interface's own host under the same secret, in text answers and
Location headers; an answer too large to hold goes on unchanged. A
request's body streams on as it arrives, an interface that sends nothing
for a minute has the request given up, and a link of a cluster that has
ended opens nothing, the node's port it found asked for again every ten
seconds while the cluster runs.

A link asked for before the primary node runs, as on a cluster no step
has run on yet, starts the node as a step would, through runOnCluster,
running nothing, and is not PresignedURLReady until the node is; its
host answers 503 meanwhile. With an ApplicationId each interface lands
on the application's page. The link lasts an hour, as Floci's page
links do. An interface Floci does not run (the Spark History Server,
the YARN timeline server, the Tez UI), and any link in the immediate
mode, still opens Floci's own page.

Floci's TLS certificate names *.emrappui.localhost and
*.emrappui.localhost.floci.io.

Lambda's CreateFunction and UpdateFunctionCode now refuse a direct
ZipFile upload over 50 MB from its Base64 length, before decoding it,
so a request already over the limit takes no more memory than it came
in; its RequestEntityTooLargeException is as before, and the test of it
builds its oversized upload without the bytes behind it.

EmrAppUiNightlyIntegrationTest runs it for real on an emr-7.5.0
cluster: the ResourceManager's link starts the primary node and opens
the ResourceManager, and after a MapReduce step its REST answer's links
open the application master's logs on the NodeManager's host and,
through the web proxy's redirect, the job on the JobHistory server's
host, as the JobHistory server's own link does. The nightly job's
timeout and image prefetch take the new check.
2026-11-17 19:48:12 -04:00
Andre Kurait 6a5a464ca8 test(emr): move Hive and Spark steps to nightly checks (#8738)
* test(emr): move Hive steps to nightly checks alongside session checks
* test(emr): declare nightly Hive and Spark timeout
2026-11-17 16:50:18 -04:00
Priamo Germosen 9821a919b6 feat(emr): run a notebook execution's notebook on its cluster in the docker runner mode (#8764)
With runner-mode docker, StartNotebookExecution now runs the notebook on
its cluster as a step's command runs: a spark-submit there, a YARN
application with the cluster's Spark settings, as the execution's
ExecutionRoleArn, else the cluster's instance profile, with its
EnvironmentVariables (KERNEL_EXTRA_SPARK_OPTS, as AWS's example passes,
going to spark-submit as its options).

No source names AWS's kernel, so a program of Floci's own runs it,
needing only Python and PySpark, which every release's image has, not
Jupyter: it reads the notebook through the cluster's S3A, puts
NotebookParams in papermill's way (a cell tagged injected-parameters
after the one tagged parameters, else first, in place of any an earlier
run left; a name that is not a Python variable's fails the run), clears
every earlier output, runs the code cells in one namespace holding spark
and sc, keeping each one's output, its last expression's value and any
error, stops at the first cell that raises, and writes the notebook as
run as <name>.ipynb and <name>.html, then exits 3. A %%sql cell runs its
body with spark.sql, a %%local or %%spark one as Python, and other cell
magics are not run; % and ! lines are dropped only from a cell that is
not Python as it stands.

The notebook is the execution's NotebookS3Location; Floci keeps no EMR
Notebook's own S3 location, so an execution named by EditorId alone
fails at once. No source gives where AWS writes the notebook as run, so
Floci writes it under the OutputNotebookS3Location prefix, else beside
the notebook, in a folder named for the execution, and reports the one
OutputNotebookFormat names, the HTML one, else the notebook, as
OutputNotebookURI. The execution is START_PENDING until its container
runs, then RUNNING, and FINISHED, FAILED at the first raising cell (any
other failure giving the run's exit code), or STOPPED,
StopNotebookExecution going through STOPPING; its cluster's end stops
it, and one a restart left behind fails as interrupted.

EmrService.runOnCluster runs such a command on a cluster through the
cluster preparation steps and sessions share, its cluster's storage held
while it runs and its end stopping it. As a step's, its thread starts
nothing once its cluster has shut down or a reset's or a shutdown's
teardown has begun; one that cannot be handed to its thread ends at
once.

EmrNotebookExecutionNightlyIntegrationTest runs it for real on an
emr-7.5.0 cluster: a parameterized notebook's run, an earlier run's
parameters in it, written to S3 with its outputs, its %%sql cell's among
them, and HTML; a failing notebook's FAILED with its error kept and an
earlier run's later outputs gone; and a misnamed parameter's run failed
with its exit code.
The nightly job's timeout and image prefetch take the new check.
2026-11-17 15:08:32 -04:00
Priamo Germosen 2517edb471 feat(emr): run a session's Spark Connect server on its cluster in the docker runner mode (#8751)
With runner-mode docker, StartSession now runs the session's Spark
Connect server on its cluster, as "Amazon EMR launches a Spark Connect
Server as a YARN application on your cluster": a container on the
cluster as a step's is, in the image its steps run in, its HDFS and
YARN started first where they are not running, the server's driver in
that container and its executors on the cluster's YARN. Its
spark-defaults are the cluster's, then the session's
EngineConfigurations, with the server's port; it runs as the session's
ExecutionRoleArn, else the cluster's instance profile.

A client reaches it through Floci as an EMR Serverless session's server
is reached (#8731): GetSessionEndpoint answers Floci's address and a
token, and a client connects with
sc://<host>:<port>/;x-aws-proxy-auth=<token>;authorization=<session id>,
AWS's string with Floci's port. The proxy drops the authorization
parameter, which AWS's own proxy reads, before the call reaches the
server.

The session is SUBMITTED until its container runs, STARTING until the
server answers, then IDLE, BUSY while a call runs on its server and
IDLE again once none does. TerminateSession goes through TERMINATING
until the server has stopped; the idle timeout stops it too, and the
cluster's end ends its sessions and stops their servers on its own,
its storage released only once the last of them has gone. A server that exits on its own, or does not answer within
10 minutes, fails the session; one a restart left behind fails as
interrupted, its container removed.

What EMR Serverless's sessions and these share moves into
emrserverless.SparkConnectServers: running each server, asking it
whether it answers, the tokens, the calls a session takes, and one
check for its next deadline; and SparkConnectSessionOwner, the states a
session goes through as its server starts, answers, takes calls and
stops, each service giving only how it stores, ends and checks its
sessions (both models implement SparkConnectSession). A server being stopped takes no new call, a call's
busy and idle reach the owner in order under the server's own lock, and
a server's entry goes even where its owner fails to hear it stopped. A step's setup on its cluster (its image, storage,
metadata address, added nodes and HDFS) moves into a preparation that
steps and sessions' servers share.

EmrSessionServerNightlyIntegrationTest runs it for real on an
emr-spark-8.1.0 cluster with Spark 4's JVM client from that image: a
wrong token refused, queries run, a missing table's Spark error back,
TerminateSession removing the server. The nightly job's timeout and
image prefetch take the new check.
2026-11-17 12:18:09 -04:00
Priamo Germosen 50276fa533 feat(emr-serverless): run a session's Spark Connect server in the docker runner mode (#8731)
With runner-mode docker, StartSession now runs the session's driver, a
Spark Connect server, in a container, as a job run's driver runs: in the
release's image or the application's custom image, on the same network,
with the execution role's credentials and the application's executors.
Its spark-defaults are the application's runtime configuration, then the
session's runtimeConfiguration; Floci sets the server's port and drops a
spark.connect.grpc.binding.address, which "is reserved by EMR Serverless
and cannot be overridden by users".

A client reaches the server through Floci. GetSessionEndpoint answers
Floci's own address, and the client puts the token in the
x-aws-proxy-auth parameter, as AWS's connection string does
(sc://<host>:443/;use_ssl=true;x-aws-proxy-auth=<token>). The new
core.common.SparkConnectProxy takes gRPC calls to
spark.connect.SparkConnectService on Floci's port, checks the token, and
forwards each call over HTTP/2, trailers included, to the server, whose
port is published on the Docker host's loopback interface only; a
Trailers-Only answer, Spark's error before any message, goes back as
one. A call
with no token, an unknown one or an expired one fails with gRPC's
UNAUTHENTICATED; one to a session that is not ready, or in the immediate
mode, with UNAVAILABLE.

The session is SUBMITTED until its container runs, STARTING until the
server answers, then IDLE. No source says when a session is BUSY: Floci
makes it BUSY while a call runs on its server and IDLE again once none
does, its idle timeout counting from then. TerminateSession goes through
TERMINATING until the container has stopped; the idle timeout, the 24
hours (counted from when the server answers) and StopApplication stop it
too, each session keeping one check for its next deadline. A server that
exits on its own, or does not answer within 10 minutes, fails the
session with the reason; one a restart left behind fails as interrupted,
and its container, if the startup's cleanup left it, is removed.

The runner's Job gains a listening port, published on loopback and
reported through Progress.listening once the container runs.

EmrServerlessSparkConnectNightlyIntegrationTest runs it for real: the
server in the emr-7.13.0 image and Spark's own JVM Spark Connect client
from that image, which runs a query through Floci with the token and is
refused with a wrong one. The nightly job's timeout and image prefetch
take the new check.
2026-11-17 07:55:24 -04:00
Priamo Germosen 30f8a9985e feat(emr): run Pig steps on Apache Pig, an opt-in download added to the cluster's image (#8636)
No AWS image carries Pig, so a Pig step failed without running. With
floci.services.emr.pig.enabled on (off by default), a docker cluster
whose Applications name Pig gets Apache Pig 0.18.0 in its image:
downloaded to a temporary file from the first of
floci.services.emr.pig.urls that gives it whole with the checksum
floci.services.emr.pig.sha256 names (a URL that fails, stalls for a
minute or gives another checksum passes to the next), then streamed
into /usr/lib/pig as EmrReleaseImages makes the image, with Tez from
the release's Hive image and a /usr/bin/pig that EMR's own pig-script
runs.

Pig runs on the image's Tez, its bundled Tez and protobuf 3 left out,
on the cluster's YARN or in local mode, with exectype=tez, a working
directory without a scheme, which S3A takes, and no task reports and
one try for counters from the MapReduce JobHistory server the cluster
does not run, then the cluster's tez-site and pig-properties, in a
pig.properties of the step's own; pig-log4j and pig-env reach Pig too. A command step's new
tez-site.xml shares Hive's Tez-on-YARN settings.

Without the setting, a Pig step on a cluster that installs Pig still
fails without running, its message naming the setting; on one that
does not, EMR's pig-script says "Pig isn't installed." as on EMR.
2026-11-16 16:25:21 -04:00
Priamo Germosen 975632df5c test(emr): run an EMR cluster from Floci in a container nightly (#8591)
Floci in a container of its own, with the Docker socket, is how many
users run it, and an EMR cluster's nodes are then its siblings on a
network of their own: Floci's container joins that network so the
cluster's metastore service reaches Floci's S3, and leaves it once the
cluster has ended. That path had unit tests and one manual run, as no
test ran Floci in a container for EMR.

EmrFlociContainerNightlyIntegrationTest starts the Floci image the
nightly workflow builds from the commit (docker/Dockerfile.jvm-package)
with the socket and the docker runner mode, runs a cluster with Hive and
Spark on it, and checks that a Hive step's tables over rows in S3 are
read by a Spark step through the metastore, that a later Hive step reads
the table the Spark step made, that Floci's container is on the
cluster's network meanwhile, and that it is off it once the cluster has
ended. A failing step's message carries its stderr and Floci's log.

The nightly workflow builds the image and names it to the checks; the
Spark and Hive images are prefetched for the class. The Hive and Spark
jobs EmrHiveStepsDockerIntegrationTest wrote inline are HiveCatalogJobs,
the step EMR tests added in two copies is EmrRequests.addStep, and the
Docker client two RDS tests built by hand is TestDockerClients.local.
2026-11-16 12:02:02 -04:00
Priamo Germosen 9ee8417f6c test(emr-serverless): run a custom image from Floci's ECR nightly (#8584)
An EMR Serverless application on a custom image in Floci's ECR had unit
tests for the digest it resolves (#8542) but no run that pushed an image
and pulled it back, as each run of it copies the whole 3.5 GB base image
into the registry. It is now a nightly check.

EmrServerlessCustomImageNightlyIntegrationTest builds the release's base
image with a FLOCI_IMAGE_BUILD marker, pushes it to a repository's tag in
Floci's ECR, removes the local copy, and runs a job that writes the marker
it sees. A second build pushed under the same tag is not seen by the
application that resolves its image as it starts until it starts again,
and is seen at once by one resolving it for each run. Floci listens on a
fixed port there, since the runner hands the Docker daemon
localhost:<floci.port> for an ECR image.

The class is enabled only by -Dnightly.checks.enabled=true, so the CI
shards skip it before Quarkus starts, and its base image is prefetched
only for the nightly checks. That property was -Dfloci.nightly=true, which
the first nightly run showed Floci's configuration refusing as a floci.*
name it does not know, so a Quarkus check never started; the workflow and
AGENTS.md name the new one. The part-file reader EmrDockerRunnerDockerIntegrationTest
kept to itself is S3TestClients.partFiles, shared by both.
2026-11-16 10:13:25 -04:00
Priamo Germosen 2d3fa5cd86 ci: run the checks too heavy for a pull request nightly (#8574)
Some checks need images of several gigabytes or long runs: an EMR
Serverless run on a custom image pushed to Floci's ECR copies the whole
3.5 GB base image into the registry on every run, and Floci running in a
container with an EMR cluster beside it needs the Floci image built
first. Every *Test class lands in one of the five CI shards, already
close to their time limit, so these have had no place to run.

The Nightly checks workflow runs the classes named
*NightlyIntegrationTest with -Dfloci.nightly=true: once a day on main, on
demand, and on a pull request that adds or changes one, so a check is
seen to pass before it merges. Each such class skips without the
property, which keeps the shards' cost at a skip. It frees the runner's
unused toolchains for the images, prefetches them through
prefetch-images.sh, and uploads the reports. GitHub-hosted runners only.
A nightly check keys its images in prefetch-images.sh on its own name, and
ci.yml hands the prefetch its shard's classes without the nightly ones, so
a shard never pulls an image for a check that skips there. AGENTS.md names
the convention.
2026-11-16 08:39:28 -04:00
Andre Kurait 065d7194b0 fix(ci): distribute slow classes sharing a test profile (#8511) 2026-11-15 18:20:50 -04:00
Andre Kurait 5d40c565d4 fix(ci): prepare Cargo sidecar images before HTTP requests (#8512) 2026-11-15 17:56:14 -04:00
Priamo Germosen 54ea160aa6 feat(emr): run a step's MapReduce and Hive's Tez on the cluster's YARN (#8151)
Where a docker cluster runs YARN its Spark ran on it, while MapReduce and
Hive's Tez stayed in local mode, in the step's container, and a job's own
-D mapreduce.framework.name=yarn failed.

- A step's mapred-site names YARN and the layout of the cluster's nodes,
  which yarn.application.classpath's default does not, S3A's AWS SDK, and
  the step's AWS environment for the application master and tasks, sized
  for a NodeManager; the cluster's mapred-site replaces them.
- A step's hadoop, hadoop-streaming and hdfs dfs run from the nodes'
  Hadoop, /usr/lib or an emr-spark-* release's /opt, set for that command
  alone, so a spark-submit in the same step keeps the release's own.
- The images hold EMR Serverless's build of Tez, whose tez-site.xml names
  its own plugins. On YARN a Hive step names the stock classes from the
  same jars, real ports and bind addresses, ${env.NM_HOST} left for the
  application master's node to fill in, Tez's jars from the node's own
  disk, and one virtual core a task, as YARN's default scheduler grants
  one and Tez gives back a container that does not match what it asked.
  Intermediate compression is off, as the image's codec needs a native
  library it lacks.

Where a cluster runs no YARN, MapReduce and Tez stay in local mode.

Two Docker cases check that a streaming job's tasks and a Hive query's
Tez tasks run in YARN's containers on the cluster's nodes. With them the
two EMR Docker classes take 651s and 402s on CI's runners, so the shard
partitioner weighs them at that, as at 280s and 260s their shard ran into
Surefire's 25 minutes.

With that split, PipesStreamEnrichmentDockerIntegrationTest ran in a JVM
where no class before it had told RestAssured how to send and read
DynamoDB's application/x-amz-json-1.0, which it relied on; it now does so
itself, as other tests do.
2026-11-12 19:20:56 -04:00
Priamo Germosen 9eb3ba38ed ci: weigh the two slow EMR Docker classes when partitioning test shards (#7901)
partition.sh balances shards by class count, which says nothing of how
long a class runs. EmrDockerRunnerDockerIntegrationTest and
EmrHiveStepsDockerIntegrationTest take about 540s between them, so the
shard holding them ran 1246s of Surefire's 1500s while the others ran
641s to 869s, and one run has already been cut at the limit.

- SLOW_CLASSES gives the seconds of those two, by class name, so a
  package rename leaves them alone. A class counts for that many average
  classes, and every other class counts as one, so with none listed the
  assignment is what it was.
- Groups are packed heaviest first by that weight rather than by their
  number of classes, and a slow class without a profile goes before the
  others, so the rest are placed around them.
- A name that no longer matches a class is an annotation, not a failure,
  as a stale key is for the image prefetch: the shards are only uneven.

Summing the 2026-11-09 run's class timings over the classes at this
commit, the slowest shard goes from 1136s to 989s. A profile of its own
for the EMR classes gave 1321s and a sixth shard 1117s, as neither tells
the partition that those classes are slow.
2026-11-10 22:47:50 -06:00
Vũ Thế Huy fcb2421ee4 fix(ci): prefetch bind-directory Docker test images (#7651)
* fix(ci): prefetch bind-directory Docker test images

* fix(ci): locate OpenSearch catalog dynamically and log unreadable image

Find OpenSearchVersions.java dynamically instead of hardcoding its path, and log to PREFETCH_LOG when the default OpenSearch image cannot be parsed.

* fix(ci): drop stale REDSHIFT_PG18 prefetch block

RedshiftMaxErrorPostgres18IntegrationTest was renamed and no longer overrides the image, so the block only warned about a stale key on every shard. The renamed test runs on the default image already prefetched by the /redshift/ line.
2026-11-09 22:24:26 -04:00
Andre Kurait a5b3fab110 fix(ci): derive Neptune prefetch images from configuration (#7834)
* fix(ci): derive Neptune prefetch images from configuration

Read the Neptune pin for Java compatibility and shared shard prefetch from application.yml. Preserve best-effort pulls, shard selection and Node retry behavior.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>

* fix(ci): share configured Neptune image lookup

Reuse one keyed lookup for Node, Java and shard prefetch. Read the Neo4j pin from configuration and correct the pre-pull overlap comment.

Signed-off-by: Andre Kurait <akurait@amazon.com>

* fix(ci): share service image read and prefetch

Use one service/key config reader across Neptune and CodeArtifact. Share configured-image pull/skip logic, preserve Node/Java failure policies and remove the unused test file.

Signed-off-by: Andre Kurait <akurait@amazon.com>

* chore(ci): remove superseded Neptune image reader

Remove the old helper left by the preceding rename publication. All consumers use the qualified shared service/key reader.

Signed-off-by: Andre Kurait <akurait@amazon.com>

---------

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-11-09 21:49:27 -04:00
Andre Kurait 99be149382 chore: add regression coverage for CI sharding (#7245)
Cover the two balancing rules with deterministic partition CLI regressions.

Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-11-09 21:40:22 -04:00
Jackson PriceandAndre Kurait aef59b9aaf ci: prefetch the PostGIS snapshot restore fixture image (#7647)
Read the restore fixture's PostgreSQL image override and prefetch it only
for the shard running that class, avoiding a cold pull during database
creation. Keep the existing best-effort pull behavior.

Source: AndreKurait/floci#487
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Signed-off-by: Jackson Price <jxnprice@amazon.com>
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
2026-11-09 02:23:17 -04:00
Hector Ventura 7cf443fcee chore: rename the package to io.floci.aws (#7689)
Move the Java sources from io.github.hectorvent.floci to io.floci.aws, matching io.floci.gcp, io.floci.az and io.floci.oci. Generated by tools/rename/rename_package.py apply on the base commit, with no other edits.

Logger categories and the arn.fail-on-blank-region property move to the io.floci.aws prefix. The pom groupId becomes io.floci; the artifactId stays floci.

Refs #6589

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-11-06 11:07:21 -04:00
Andre Kurait a389299b67 chore(ci): prefetch missing container fixture images (#7474)
* chore(ci): prefetch missing container fixture images

Prefetch configured DSQL, PostgreSQL 18, CodeArtifact, MySQL and OpenSearch images only for consuming fixture shards. Preserve best-effort background pulls and current Hive selection.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>

* fix(ci): skip unused mock OpenSearch image prefetch

The OpenSearch domain options fixture uses mock mode and never starts its engine container. Preserve prefetches for the actual consuming fixtures.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>

---------

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
2026-11-05 08:20:32 -06:00
Priamo Germosen 3a64d2b761 feat(emr): give each docker cluster a real HDFS on its primary node (#7496)
Every EMR cluster runs HDFS: its primary node "also runs the HDFS
NameNode service". In the docker runner mode a cluster's HDFS was a
folder of its /mnt volume behind a view of the hdfs scheme, so an
hdfs:// path naming a host was not served, hadoop fs -ls / failed, and
Hive, which looks up the encryption zone of any hdfs:// path, reached it
under viewfs, where a table at an hdfs:// location failed. Each cluster
now runs a NameNode and a DataNode.

- EmrClusterStorage starts them in a container of their own, from the
  release's EMR Serverless Hive image, which has HDFS's daemons where
  the release's image has only the client. It runs as root only to add
  the primary node's name to its hosts file and give its data volume to
  the hadoop user, then runs both daemons as that user, with one copy of
  each block and permissions off, and makes /tmp and /user/hadoop once
  the DataNode has joined. The data is in a volume of its own, so the
  first container to mount the cluster's /mnt volume is still a step's,
  which fills it with what the bootstrap actions left there. It is on a
  Docker network of the cluster's own, which only the cluster's steps
  join besides theirs, as its HDFS serves its files to any client that
  reaches it, so another cluster's steps, another account's too, do not.
- The AWS runtime for Apache Spark's releases, emr-spark-8.0.0 on,
  publish no Hive image, so their clusters run HDFS from emr-7.5.0's.
  Hadoop keeps its client-server protocols compatible across a major
  version's minor releases, so their newer client reaches its NameNode.
- A step's thread starts it after the cluster's volumes, from the id
  its image's pull, when it is missing, resolves, and waits up to two
  minutes from then, the
  NameNode on its port its own, the DataNode joined and the NameNode out
  of safe mode, as the NameNode's JMX says; a step that comes while
  it starts waits, and one that finds it running uses it. A failure
  fails the step ("The step could not start: ..."), and one whose
  container Docker cannot tell the state of leaves it as it is.
- The daemons log their warnings and errors to the container's output.
- When either daemon exits, the container ends and its readiness goes,
  so the next step starts it again on the data its volume keeps; one
  that finds it about to stop starts it again once.
- Steps reach it by the primary instance's PrivateDnsName, as
  ListInstances gives it, on port 8020: their containers resolve that
  name to the HDFS container's address, and fs.defaultFS names it, so
  hdfs:// paths without a host and paths without a scheme lead there.
  ListInstances numbers the MASTER group's instance first, so the name
  holds while other groups resize.
  In a namespace the steps share, the host's or another container's,
  which the HDFS container joins too, they reach it on its loopback, and
  its daemons listen there only, so no other interface serves its files,
  which any client could change; one cluster's HDFS runs there at a
  time, another's refused while it does. One a process with another
  docker-network left running, in another namespace than the steps', is
  started again in theirs on its data. With none, steps have no network,
  so the cluster runs no HDFS.
- Hadoop's local job runner copies a job's -files to
  /tmp/hadoop/mapred/staging on the local file system, then looks for
  them at that path of the default file system, as JobResourceUploader
  drops the folder's scheme. So in the hadoop command's configuration,
  which a custom JAR's MapReduce in the driver reads too, the hdfs
  scheme is a view of the cluster's HDFS in which that one folder is
  the container's own. Spark and Hive keep HDFS's own client, as Hive
  casts an hdfs:// file system to it to look up its encryption zone,
  so a Spark step writes a Hive table in HDFS too.
- A reset or a shutdown removes the HDFS containers this process
  started, found running or kept from an earlier process, after the
  drivers that use them are stopped, and a step or a bootstrap handed to
  its thread before it, however it then ends, starts no HDFS, driver or
  successor after it but is left as one whose driver was stopped, and
  none is handed to a thread until the reset is over; a container Docker
  refuses to remove stays known for the next; a cluster's next step
  starts its HDFS again on the data its volume keeps. The container and
  its network go with the cluster's storage, and the startup sweep
  removes those of clusters that are gone or have ended.

Every cluster now needs a Hive image, so the documentation of
image-template and hive-image-template says a mirror sets both.

The Docker-gated tests now cover a Hive table at an hdfs:// location, a
bootstrap action's file in /mnt, a structured streaming query keeping
its checkpoints in HDFS, a Spark step writing a Hive table there, hadoop
fs -ls /, and a DataNode that exits, after which the next step reads an
earlier step's file. The CI prefetch queues the Hive image for
EmrDockerRunnerDockerIntegrationTest's shard too.
2026-11-04 21:50:36 -06:00
Priamo Germosen 5a4632229e feat(emr): run Hive steps in the docker runner mode (#7459)
In the docker runner mode a Hive step failed without running ("hive-script
and pig-script are not in the image steps run in"). On a cluster whose
Applications name Hive, a command-runner.jar step running hive-script, as
the AWS CLI writes a Type=Hive step ("hive-script --run-hive-script
--args" and the step's Args), or hive itself, now runs: the image's
hive-script runs hive with the arguments after --args, with Tez in local
mode, on the cluster's storage and Floci's S3.

- An EMR cluster's nodes hold every application it installs, so a
  cluster with Hive bootstraps and runs every step in one image: the
  release's EMR Serverless image with the Hive, Tez, HDFS, MapReduce and
  YARN of its EMR Serverless Hive image (or the new hive-image-template).
  EmrReleaseImages makes it the first time a release's cluster needs it:
  a container of the EMR Serverless image, created and never started,
  gets the Hive image's folders streamed in from a container of that
  image, and is committed, as a bootstrap's container is, with no image
  builder involved. The two images ship different builds of
  emr-serverless-goodies-common under one name, so Tez keeps the Hive
  image's in a folder of its own, its links rewritten to lead there, and
  the Hive image's Hadoop configuration, which puts Tez on the class
  path, goes to /etc/hadoop/conf.hive, which Hive runs with.
- The image is named after the release, the ids of the two images as a
  container would run them (an image-registry-base included) and what
  is copied, so a newer pull of either makes another; it is kept for the
  release's next cluster, and made once at a time. The bootstrap and the
  steps get its id, as they get a bootstrap image's, from their own
  thread, which makes it first, unless the cluster has ended by then; a
  failure to make it fails the step, or ends a bootstrapping cluster with
  INTERNAL_ERROR.
- hive gets Floci's settings, then the cluster's core-site, tez-site and
  hive-site properties as --hiveconf settings, then the step's own
  arguments, so a step's --hiveconf wins as it does over hive-site.xml;
  the cluster's hive-env exports are its environment.
- Its metastore is the cluster's own, as "Hive records metastore
  information in a MySQL database on the primary node's file system": an
  embedded Derby database in the cluster's /mnt, so a table one Hive step
  makes is there for the next until the cluster ends. A hive-site naming
  the Glue Data Catalog's client factory uses Floci's Glue instead.
- Hive reaches the cluster's HDFS through the same view of /mnt/hdfs
  under the viewfs scheme: Hive looks up the HDFS encryption zone of any
  hdfs:// path, which only an HDFS NameNode answers. A table without a
  LOCATION is in /user/hive/warehouse there, which other steps read as
  hdfs://.
- On a cluster without Hive, hive-script runs in the release's image, as
  EMR's does without Hive ("Hive isn't installed."); NOT_RUN is
  pig-script's alone.

The Docker-gated EmrHiveStepsDockerIntegrationTest runs the AWS CLI's
Hive steps on a cluster's metastore and HDFS, a hive-site for the Glue
Data Catalog, a cluster without Hive, and a bootstrapped cluster whose
installs a Hive step and a later step both find, in the emr-7.5.0
images, which the CI prefetch pulls for its shard.
EmrServerlessSparkRunner's hiveSettings now builds both services'
--hiveconf settings.
2026-11-03 23:18:20 -06:00
Priamo Germosen 710b2488bf feat(emrserverless): run Hive job runs in the docker runner mode (#7407)
In the docker runner mode a Hive application's job run failed without
running ("Floci runs Spark job runs only"). It now runs: Floci starts
hive in a container of the release's EMR Serverless Hive image
(public.ecr.aws/emr-serverless/hive/<release>, or the new
hive-image-template), with Tez in local mode in Hive's JVM, S3A on
Floci's S3 and the Glue Data Catalog client, the image's metastore, on
Floci's Glue in the run's account.

- hive gets the core-site, tez-site and hive-site classifications as
  --hiveconf settings, the application's then the run's, a run's
  classification replacing the application's; then -i initQueryFile
  and -f query; then the run's parameters, whose --hiveconf settings
  take priority, as the user guide ranks them.
- The run's hive.exec.scratchdir and hive.metastore.warehouse.dir are
  used as it sets them, in S3. Tez in local mode copies a session's
  staging folder, which Hive puts under the scratch folder, to the same
  path in the container, a copy that silently does nothing where the
  image's hadoop user cannot create that path. The container starts as
  root, makes that path hadoop's, sets the Tez addresses EMR
  Serverless's runtime would set, then runs hive as hadoop in its home
  folder, with the groups Docker gives it. The scratch folder is the
  last hive.exec.scratchdir setting, in any form Hive's CLI reads:
  --hiveconf name=value, --hiveconf=name=value, with one dash or two,
  or the value as the next argument.
- A Hive application's custom image is its HiveDriver worker type's,
  else the application's; Tez's tasks run in the driver's container, so
  a TezTask image is not used.
- The driver's stdout.gz and stderr.gz go to the run's HIVE_DRIVER log
  folder, and its CloudWatch log streams are under HIVE_DRIVER, the
  entry of logTypes it reads; Hive's own log stays in the container.
- A run whose driver is not its application's type, hive on a Spark
  application or sparkSubmit on a Hive one, fails without running.

spark-defaults go through the same classification merge. The
Docker-gated EmrServerlessHiveDockerIntegrationTest runs the user
guide's Hive job and a failing query in the emr-7.5.0 Hive image, which
the CI prefetch pulls for its shard. EmrServerlessRequests'
createApplication takes the application's type, and S3TestClients'
deleteBucket empties and deletes a test's bucket.
2026-11-03 17:14:56 -06:00
Priamo Germosen b63e4a5bb9 test(emr): run steps and job runs through the Docker runner (#7349)
No EMR test ran a step or a job run through Floci's Docker runner: the
runner's wrappers and settings were unit tested and run by hand in the
images. EmrDockerRunnerDockerIntegrationTest, a Docker-gated
@QuarkusTest on ContainerDataPlaneProfile (which now sets both runner
modes to docker), runs them for real in the emr-7.5.0 image, reaching
Floci's S3 from the container:

- a hadoop-streaming word count step, its mapper and reducer from S3,
  writing its counts to S3;
- the same word count as a custom JAR at EMR's streaming jar path;
- s3-dist-cp from S3 into the cluster's HDFS and back;
- a cluster's spark-env export, read by a Spark step's driver;
- an EMR Serverless run on the user guide's virtual environment recipe,
  spark.archives with #environment and the driver's and executors'
  Python in it, from an archive that needs no package index.

EmrRequests.awaitStep and EmrServerlessRequests' createSparkApplication,
startJobRun and awaitJobRun are shared helpers, each wait checking that
its call answered 200 before reading the state, and
RetryingTarCopier.putEntry, pulled out of singleFileTar, writes the
archive's entries. The CI prefetch queues the 3.5 GB image for the
shard that runs the class, last, behind the Lambda runtimes, and the
prefetch results step no longer warns about an EMR Serverless image on
ECR Public, the only place AWS publishes them.
2026-11-02 17:31:59 -06:00
Priamo Germosen 2d17978bf7 ci: run the test suite in five shards (#7303)
One shard was cut by the 25-minute job limit twice on 2026-11-02, at 25m15s
and 25m26s, and no test had failed in it either time: the reports it uploaded
before the cut carried 13459 tests with no failures and no errors. The suite
has grown into the budget rather than anything having broken, and a fifth
shard is what gives it room.

The partitioner needs no change. It takes the shard total as an argument and
balances by class count with each @TestProfile group kept whole, and the
completeness gate checks the shards it is handed against the commit's own
class list rather than a count. So this is the matrix, the total beside it,
and the comments that named four.

Measured over the 3223 test classes on main today, with each class's time
taken from the surefire reports of one four-shard run:

  four shards   13.8  13.3  17.1  13.8        minutes of tests
  five shards   12.6  12.1  12.4  10.7  10.2

The slowest shard loses 27 percent of its test time, 17.1 minutes down to
12.6, and the spread across shards narrows from 3.8 to 2.4. A shard pays
about 2m15s before its first test, 1m52s of that the compile, so the fifth
job costs that much runner time while the critical path drops by about four
and a half minutes.

What this does not do is balance by duration. The partitioner weighs classes
and profile groups rather than seconds, which is how one shard of four came
to carry 17.1 minutes against another's 13.3. Five shards leave more headroom
over that imbalance; they do not remove it.
2026-11-02 07:53:47 -06:00
Hector Ventura 488a3197f1 chore(compat): close the SES races and report pre-pull and class timings (#7221)
Review of #7212 left three gaps in the parallel sdk-test-java setup.

The classes that create SES contact lists share a one-list-per-account limit
and three of them delete every list, and SesAccountAttributesTest turns
account sending off while other classes send. All of them now hold
ses-account, which costs about 8 s of serial time.

The pre-pull step discarded its output, so a failed pull only showed as a
slower run. Each pull now records its result and duration, and a step puts
them in the job summary with a warning when one failed.

Under JUnit parallel execution Surefire writes some test cases into another
class's XML file, so the timing report credited them to the wrong class. It
now sums per test case classname, which also splits sdk-test-python's single
"pytest" row into its classes.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-11-01 12:20:58 -04:00