Files
floci/.github
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
..