mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
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.