mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
feat(emr-serverless): give a job run's driver its driverEnv and S3 archives (#7107)
In the docker runner mode the user guide's way of giving an EMR
Serverless job run its Python libraries did nothing. "Building a Python
virtual environment" packs a virtualenv into an archive in S3 and
submits the job with:
--conf spark.archives=s3://.../pyspark_venv.tar.gz#environment
--conf spark.emr-serverless.driverEnv.PYSPARK_DRIVER_PYTHON=./environment/bin/python
--conf spark.emr-serverless.driverEnv.PYSPARK_PYTHON=./environment/bin/python
--conf spark.executorEnv.PYSPARK_PYTHON=./environment/bin/python
Floci set no driverEnv variable on the driver's container, and Spark in
local mode unpacks spark.archives into a temporary files folder of its
own once the driver's Python has started, not into the working
directory. With the variables set, the driver could not start: "Cannot
run program "./environment/bin/python"".
Now:
- a spark.emr-serverless.driverEnv.<KEY> property ("Option that adds
environment variables to the Spark driver"), from the run's
spark-defaults or a --conf in its sparkSubmitParameters, which wins,
is an environment variable of the driver's container, replacing one
of Floci's own of that name;
- each archive of spark.archives (which spark-submit's own --archives
sets, winning over a --conf, as in Spark) in Floci's S3 is read as the
run's account, streamed into the created container and unpacked into
its working directory before spark-submit starts, under the name after
its # or else its file's name, as Spark's Utils.unpack does it (.jar
and .zip unzipped, .tar.gz, .tgz and .tar untarred, anything else
copied). The guide's venv-pack example puts the environment in
/home/hadoop/environment, and /home/hadoop is the image's working
directory. An archive that cannot be read fails the run before its
driver starts, naming it; a cancel, a reset or a shutdown while they
are put in ends the copy and puts in no other.
SparkJobRunner.Job carries the archives, which classic EMR's steps
leave empty. Spark still unpacks each archive into its own files folder
too, where SparkFiles.get finds it, and gives spark.executorEnv
variables to the Python workers it starts, so those need nothing more.
This commit is contained in:
1 parent
81e1dbc573
commit
2b6a8b4e66
7 files changed
+536
-16
No files matched your search
@@ -1322,7 +1322,7 @@ public class EmrService implements Resettable {
|
||||
EmrSparkSteps.sparkDefaults(cluster.getConfigurations(), SNAPSHOT_MAPPER),
|
||||
application != null ? application : List.of(), command, Duration.ZERO,
|
||||
EmrSparkSteps.logFolder(cluster, step), null,
|
||||
EmrSparkSteps.sparkEnvironment(cluster.getConfigurations(), SNAPSHOT_MAPPER));
|
||||
EmrSparkSteps.sparkEnvironment(cluster.getConfigurations(), SNAPSHOT_MAPPER), List.of());
|
||||
StepLaunch launch = new StepLaunch(accountId, region, cluster.getId(), step.getId(), generation);
|
||||
executing.add(stepKey(accountId, step.getId()));
|
||||
stepExecutor.execute(() -> runStep(job, launch));
|
||||
|
||||
+72
-3
@@ -39,6 +39,7 @@ import java.time.OffsetDateTime;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -92,6 +93,13 @@ public class EmrServerlessJobRunService implements Resettable {
|
||||
private static final String SPARK_DRIVER = "SPARK_DRIVER";
|
||||
// The worker type a Spark application's driver runs as.
|
||||
private static final String DRIVER_WORKER_TYPE = "Driver";
|
||||
// spark-submit's option for a Spark property, and its short form; and its option for spark.archives.
|
||||
private static final String CONF_OPTION = "--conf";
|
||||
private static final String CONF_SHORT_OPTION = "-c";
|
||||
private static final String ARCHIVES_OPTION = "--archives";
|
||||
// "Option that adds environment variables to the Spark driver."
|
||||
private static final String DRIVER_ENV_PREFIX = "spark.emr-serverless.driverEnv.";
|
||||
private static final String SPARK_ARCHIVES = "spark.archives";
|
||||
// No source gives AWS's wording for these; they are Floci's.
|
||||
static final String HIVE_NOT_RUN = "Floci runs Spark job runs only, and this is a Hive job run.";
|
||||
static final String INTERRUPTED = "Floci stopped while the job run was in progress.";
|
||||
@@ -470,7 +478,8 @@ public class EmrServerlessJobRunService implements Resettable {
|
||||
/** Hands a container run to a thread of its own, which runs it to its end. */
|
||||
private void launch(JobRunRecord record, Application app) {
|
||||
JobRun run = record.getJobRun();
|
||||
if (run.getJobDriver().getSparkSubmit() == null) {
|
||||
JobDriver.SparkSubmit sparkSubmit = run.getJobDriver().getSparkSubmit();
|
||||
if (sparkSubmit == null) {
|
||||
run.setStateDetails(HIVE_NOT_RUN);
|
||||
finish(record, STATE_FAILED, run.getCreatedAt());
|
||||
return;
|
||||
@@ -480,10 +489,12 @@ public class EmrServerlessJobRunService implements Resettable {
|
||||
Long minutes = run.getExecutionTimeoutMinutes();
|
||||
Duration timeout = MODE_STREAMING.equals(run.getMode()) || minutes == null || minutes == 0
|
||||
? Duration.ZERO : Duration.ofMinutes(minutes);
|
||||
Map<String, String> sparkDefaults = sparkDefaults(app, run);
|
||||
Map<String, String> sparkProperties = sparkProperties(sparkDefaults, sparkSubmit);
|
||||
SparkJobRunner.Job job = new SparkJobRunner.Job(SERVICE, run.getJobRunId(), arn.accountId(), arn.region(),
|
||||
run.getReleaseLabel(), imageTemplate, customImage(app), dockerNetwork, run.getExecutionRole(),
|
||||
sparkDefaults(app, run), application(run.getJobDriver().getSparkSubmit()), null, timeout,
|
||||
driverLogFolder(app, run), driverCloudWatchLogs(app, run), Map.of());
|
||||
sparkDefaults, application(sparkSubmit), null, timeout, driverLogFolder(app, run),
|
||||
driverCloudWatchLogs(app, run), driverEnvironment(sparkProperties), archives(sparkProperties));
|
||||
executing.add(run.getJobRunId());
|
||||
long launchedIn = generation;
|
||||
runExecutor.execute(() -> execute(job, launchedIn));
|
||||
@@ -531,6 +542,64 @@ public class EmrServerlessJobRunService implements Resettable {
|
||||
return application;
|
||||
}
|
||||
|
||||
/**
|
||||
* A run's Spark properties as its driver gets them: its {@code spark-defaults}, then the {@code --conf}
|
||||
* settings of its {@code sparkSubmitParameters}, which {@code spark-submit} lets win, a later one over an
|
||||
* earlier. A setting without an {@code =}, which {@code spark-submit} refuses, sets nothing. The last
|
||||
* {@code --archives} option is {@code spark.archives}, winning over any setting of it, as
|
||||
* {@code spark-submit} has it.
|
||||
*/
|
||||
static Map<String, String> sparkProperties(Map<String, String> sparkDefaults, JobDriver.SparkSubmit sparkSubmit) {
|
||||
Map<String, String> properties = new LinkedHashMap<>(sparkDefaults);
|
||||
List<String> parameters = EmrServerlessSparkRunner.splitParameters(sparkSubmit.getSparkSubmitParameters());
|
||||
String archivesOption = null;
|
||||
for (int i = 0; i < parameters.size(); i++) {
|
||||
String parameter = parameters.get(i);
|
||||
String setting = null;
|
||||
if (parameter.startsWith(CONF_OPTION + "=")) {
|
||||
setting = parameter.substring(CONF_OPTION.length() + 1);
|
||||
} else if ((CONF_OPTION.equals(parameter) || CONF_SHORT_OPTION.equals(parameter))
|
||||
&& i + 1 < parameters.size()) {
|
||||
setting = parameters.get(++i);
|
||||
} else if (parameter.startsWith(ARCHIVES_OPTION + "=")) {
|
||||
archivesOption = parameter.substring(ARCHIVES_OPTION.length() + 1);
|
||||
} else if (ARCHIVES_OPTION.equals(parameter) && i + 1 < parameters.size()) {
|
||||
archivesOption = parameters.get(++i);
|
||||
}
|
||||
int equals = setting != null ? setting.indexOf('=') : -1;
|
||||
if (equals > 0) {
|
||||
properties.put(setting.substring(0, equals), setting.substring(equals + 1));
|
||||
}
|
||||
}
|
||||
if (archivesOption != null) {
|
||||
properties.put(SPARK_ARCHIVES, archivesOption);
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
/** The environment variables a run's driver gets: its {@code spark.emr-serverless.driverEnv.<KEY>} properties. */
|
||||
static Map<String, String> driverEnvironment(Map<String, String> sparkProperties) {
|
||||
Map<String, String> environment = new LinkedHashMap<>();
|
||||
sparkProperties.forEach((key, value) -> {
|
||||
if (key.startsWith(DRIVER_ENV_PREFIX) && key.length() > DRIVER_ENV_PREFIX.length()) {
|
||||
environment.put(key.substring(DRIVER_ENV_PREFIX.length()), value);
|
||||
}
|
||||
});
|
||||
return environment;
|
||||
}
|
||||
|
||||
/**
|
||||
* A run's {@code spark.archives}: a comma-separated list, of which Spark takes each entry trimmed and drops
|
||||
* the empty ones.
|
||||
*/
|
||||
static List<String> archives(Map<String, String> sparkProperties) {
|
||||
String archives = sparkProperties.get(SPARK_ARCHIVES);
|
||||
if (archives == null) {
|
||||
return List.of();
|
||||
}
|
||||
return Arrays.stream(archives.split(",")).map(String::trim).filter(archive -> !archive.isEmpty()).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* A reset has begun: the runs' threads from before it write nothing more, so the storage wipe that
|
||||
* follows leaves none of their runs behind. Its teardown has already stopped their drivers.
|
||||
|
||||
+148
-6
@@ -7,6 +7,7 @@ import com.github.dockerjava.api.model.Frame;
|
||||
import com.github.dockerjava.api.model.StreamType;
|
||||
import io.github.hectorvent.floci.config.EmulatorConfig;
|
||||
import io.github.hectorvent.floci.config.EmulatorConfig.EcsServiceConfig.ImagePullBehavior;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.common.ContainerTeardown;
|
||||
import io.github.hectorvent.floci.core.common.RequestScopes;
|
||||
import io.github.hectorvent.floci.core.common.S3Uri;
|
||||
@@ -17,12 +18,15 @@ import io.github.hectorvent.floci.core.common.docker.ContainerLogStreamer;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerSpec;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerStorageHelper;
|
||||
import io.github.hectorvent.floci.core.common.docker.LaunchedContainerAwsEnv;
|
||||
import io.github.hectorvent.floci.core.common.docker.RetryingTarCopier;
|
||||
import io.github.hectorvent.floci.services.ecr.registry.EcrRegistryManager;
|
||||
import io.github.hectorvent.floci.services.iam.model.SessionCreds;
|
||||
import io.github.hectorvent.floci.services.lambda.launcher.LambdaExecutionRoleCredentials;
|
||||
import io.github.hectorvent.floci.services.s3.S3Service;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -30,6 +34,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.time.Clock;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
@@ -39,6 +44,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
/**
|
||||
@@ -48,7 +54,8 @@ import java.util.zip.GZIPOutputStream;
|
||||
* in local mode: the container holds the driver and its executors. The container reaches Floci as the
|
||||
* other containers Floci launches do, with the run's execution role as its credentials, and S3A, which
|
||||
* takes {@code s3://} on every release, is pointed at Floci's S3. With TLS on, every JVM in the container
|
||||
* trusts Floci's CA, through the Java trust store copied in before it starts. The driver's output goes to
|
||||
* trusts Floci's CA, through the Java trust store copied in before it starts, and the run's archives in S3
|
||||
* are unpacked into its working directory before the driver starts. The driver's output goes to
|
||||
* Floci's log and, while it runs, to the run's CloudWatch log streams, when it has some; once it ends, its
|
||||
* standard output and error go, gzipped, to the run's log folder in Floci's S3, when it has one.
|
||||
*/
|
||||
@@ -72,6 +79,28 @@ public class EmrServerlessSparkRunner implements SparkJobRunner, ContainerTeardo
|
||||
"printf '%s\\n' \"$" + SPARK_DEFAULTS_VARIABLE + "\" >> \"$conf/spark-defaults.conf\"",
|
||||
"export SPARK_CONF_DIR=\"$conf\"",
|
||||
"exec \"$@\"");
|
||||
// The archives a driver needs in its working directory are put in this folder of its container, each in a
|
||||
// numbered folder of its own, which the copy creates.
|
||||
private static final String ARCHIVES_FOLDER = "/tmp/floci-archives";
|
||||
// While an archive is streamed in, a stop is looked for after each this many bytes, as Progress.cancelled()
|
||||
// takes the run service's lock.
|
||||
private static final long STOP_LOOK_BYTES = 4L * 1024 * 1024;
|
||||
private static final int ARCHIVE_BUFFER_BYTES = 64 * 1024;
|
||||
// Gets each archive's file and the directory it goes to, then "--" and what runs after, and unpacks each into
|
||||
// the working directory as Spark's Utils.unpack does: a .jar or .zip unzipped, a .tar.gz, .tgz or .tar
|
||||
// untarred, and any other file copied.
|
||||
private static final String ARCHIVES_WRAPPER = String.join("\n",
|
||||
"shopt -s nocasematch",
|
||||
"while [ \"$1\" != -- ]; do",
|
||||
" case \"$1\" in",
|
||||
" *.jar|*.zip) mkdir -p \"$2\" && unzip -q -o \"$1\" -d \"$2\" ;;",
|
||||
" *.tar.gz|*.tgz|*.tar) mkdir -p \"$2\" && tar -xf \"$1\" -C \"$2\" ;;",
|
||||
" *) cp \"$1\" \"$2\" ;;",
|
||||
" esac || exit",
|
||||
" shift 2",
|
||||
"done",
|
||||
"shift",
|
||||
"exec \"$@\"");
|
||||
private static final String DEFAULT_IMAGE =
|
||||
"public.ecr.aws/emr-serverless/spark/%s:latest"; // partition-literal: ECR Public's registry host, where AWS publishes the base images; image-template overrides it
|
||||
// The AWS runtime for Apache Spark (emr-spark-8.0.0 on) publishes its images under spark4/ instead.
|
||||
@@ -143,16 +172,18 @@ public class EmrServerlessSparkRunner implements SparkJobRunner, ContainerTeardo
|
||||
// The deployment that started the driver, which removeLeftoverDrivers() goes by.
|
||||
labels.put(ContainerStorageHelper.OWNER_LABEL, ContainerStorageHelper.ownerIdentity(config));
|
||||
String endpoint = awsEnv.flociEndpoint();
|
||||
List<Archive> archives = archives(job);
|
||||
ContainerBuilder.Builder container = containerBuilder.newContainer(launchImage(job))
|
||||
.withName(ContainerStorageHelper.dockerName(config, job.service() + "-" + job.runId()))
|
||||
.withEnv(environment(
|
||||
awsEnv.sdkBaselineEnv(job.region(), Optional.empty(), credentials, job.accountId()),
|
||||
job.environment()));
|
||||
if (job.command() == null) {
|
||||
container.withEntrypoint(List.of(SPARK_SUBMIT)).withCmd(sparkSubmitArguments(job, endpoint));
|
||||
container.withEntrypoint(unpackingFirst(archives, List.of(SPARK_SUBMIT)))
|
||||
.withCmd(sparkSubmitArguments(job, endpoint));
|
||||
} else {
|
||||
// bash -c's script gets "floci" as its $0, and the command as its arguments, "$@".
|
||||
container.withEntrypoint(List.of("/bin/bash", "-c", COMMAND_WRAPPER, "floci"))
|
||||
container.withEntrypoint(unpackingFirst(archives, List.of("/bin/bash", "-c", COMMAND_WRAPPER, "floci")))
|
||||
.withCmd(job.command())
|
||||
.withEnv(SPARK_DEFAULTS_VARIABLE, sparkDefaultsFile(job, endpoint));
|
||||
}
|
||||
@@ -166,9 +197,12 @@ public class EmrServerlessSparkRunner implements SparkJobRunner, ContainerTeardo
|
||||
.build();
|
||||
String containerId = lifecycleManager.create(spec);
|
||||
launch.started(containerId);
|
||||
// A stop, a reset or a shutdown while the image was pulled or the trust store copied is read now,
|
||||
// before the driver starts.
|
||||
if (launch.stopRequested() || progress.cancelled()) {
|
||||
// A stop, a reset or a shutdown while the image was pulled, the trust store copied or the archives put
|
||||
// in is read now, before the driver starts; one before an archive or while it streams in puts in no
|
||||
// more of them.
|
||||
BooleanSupplier stopped = () -> launch.stopRequested() || progress.cancelled();
|
||||
putArchives(job, archives, containerId, stopped);
|
||||
if (stopped.getAsBoolean()) {
|
||||
return Outcome.halted();
|
||||
}
|
||||
lifecycleManager.startCreated(containerId, spec);
|
||||
@@ -321,6 +355,46 @@ public class EmrServerlessSparkRunner implements SparkJobRunner, ContainerTeardo
|
||||
return new ArrayList<>(byName.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* A job's archives in S3, which its driver finds in its working directory: each with the file it is put at, in
|
||||
* a folder of its own, and the directory it is unpacked to, named as Spark names it, by what follows its
|
||||
* {@code #} or else by its file's name. Spark alone unpacks the others, into its own files folder.
|
||||
*/
|
||||
static List<Archive> archives(Job job) {
|
||||
List<Archive> archives = new ArrayList<>();
|
||||
for (String archive : job.archives()) {
|
||||
int hash = archive.indexOf('#');
|
||||
String path = hash < 0 ? archive : archive.substring(0, hash);
|
||||
if (!S3Uri.isS3(path)) {
|
||||
continue;
|
||||
}
|
||||
S3Uri location = S3Uri.parseAnyScheme(path);
|
||||
String name = location.key().substring(location.key().lastIndexOf('/') + 1);
|
||||
if (name.isEmpty()) {
|
||||
throw new IllegalArgumentException("The archive " + archive + " names no object.");
|
||||
}
|
||||
String file = ARCHIVES_FOLDER + "/" + (archives.size() + 1) + "/" + name;
|
||||
archives.add(new Archive(path, location, file, hash < 0 ? name : archive.substring(hash + 1)));
|
||||
}
|
||||
return archives;
|
||||
}
|
||||
|
||||
/** {@code entrypoint}, after the wrapper that unpacks {@code archives} into the working directory, if any. */
|
||||
static List<String> unpackingFirst(List<Archive> archives, List<String> entrypoint) {
|
||||
if (archives.isEmpty()) {
|
||||
return entrypoint;
|
||||
}
|
||||
// bash -c's script gets "floci" as its $0, then each archive's file and directory, "--" and the entrypoint.
|
||||
List<String> unpacking = new ArrayList<>(List.of("/bin/bash", "-c", ARCHIVES_WRAPPER, "floci"));
|
||||
for (Archive archive : archives) {
|
||||
unpacking.add(archive.file());
|
||||
unpacking.add(archive.directory());
|
||||
}
|
||||
unpacking.add("--");
|
||||
unpacking.addAll(entrypoint);
|
||||
return unpacking;
|
||||
}
|
||||
|
||||
/**
|
||||
* The image a run's driver starts from: the release's, or the template's, or the application's custom
|
||||
* image. A custom image's ECR URI leads to Floci's own registry, as a Lambda function's or an ECS task's
|
||||
@@ -336,6 +410,67 @@ public class EmrServerlessSparkRunner implements SparkJobRunner, ContainerTeardo
|
||||
return lifecycleManager.resolveImageForLaunch(image, ImagePullBehavior.DEFAULT, null).imageId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts each archive in the created container, for its entrypoint to unpack: read from Floci's S3 as the run's
|
||||
* account and streamed in, so Floci holds little of it however large it is. One that cannot be read fails
|
||||
* the run, naming it. Once the run is {@code stopped}, no other archive is put in, and the one streaming in
|
||||
* stops, leaving run() to read the stop.
|
||||
*/
|
||||
private void putArchives(Job job, List<Archive> archives, String containerId, BooleanSupplier stopped) {
|
||||
for (Archive archive : archives) {
|
||||
if (stopped.getAsBoolean()) {
|
||||
return;
|
||||
}
|
||||
S3Uri location = archive.location();
|
||||
try {
|
||||
RequestScopes.runAs(job.accountId(), job.region(),
|
||||
() -> s3Service.headObject(location.bucket(), location.key()));
|
||||
} catch (AwsException e) {
|
||||
throw new IllegalArgumentException(
|
||||
"Could not read the archive " + archive.path() + ": " + e.getMessage(), e);
|
||||
}
|
||||
try {
|
||||
// Extracted at the root, the entry is the file's path without its leading slash.
|
||||
RetryingTarCopier.copyStreamed(lifecycleManager.getDockerClient(), containerId, "/", archive.path(),
|
||||
out -> {
|
||||
try (S3Service.ObjectRead read = RequestScopes.callAs(job.accountId(), job.region(),
|
||||
() -> s3Service.openObject(location.bucket(), location.key(), null));
|
||||
TarArchiveOutputStream tar = RetryingTarCopier.newTarStream(out)) {
|
||||
TarArchiveEntry entry = new TarArchiveEntry(archive.file().substring(1));
|
||||
entry.setSize(read.object().getSize());
|
||||
entry.setMode(0644);
|
||||
tar.putArchiveEntry(entry);
|
||||
transferUntilStopped(read.body(), tar, stopped);
|
||||
tar.closeArchiveEntry();
|
||||
}
|
||||
});
|
||||
} catch (RuntimeException e) {
|
||||
// A copy the stop ended, or one whose container a reset removed.
|
||||
if (stopped.getAsBoolean()) {
|
||||
return;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Copies {@code in} to {@code out}, failing once the run is {@code stopped}, as looked at each few MiB. */
|
||||
private static void transferUntilStopped(InputStream in, OutputStream out, BooleanSupplier stopped)
|
||||
throws IOException {
|
||||
byte[] buffer = new byte[ARCHIVE_BUFFER_BYTES];
|
||||
long sinceLook = 0;
|
||||
for (int read = in.read(buffer); read >= 0; read = in.read(buffer)) {
|
||||
out.write(buffer, 0, read);
|
||||
sinceLook += read;
|
||||
if (sinceLook >= STOP_LOOK_BYTES) {
|
||||
sinceLook = 0;
|
||||
if (stopped.getAsBoolean()) {
|
||||
throw new IOException("the job run was stopped");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code spark-submit}'s arguments: local mode, S3A on Floci's S3 for {@code s3://} and {@code s3a://}
|
||||
* paths, then the run's {@code spark-defaults} and its own options, which win over what comes before
|
||||
@@ -404,6 +539,13 @@ public class EmrServerlessSparkRunner implements SparkJobRunner, ContainerTeardo
|
||||
private record SparkSetting(String key, String value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* A job's archive in S3: its path and where that is, the file it is put at in the container, and the directory
|
||||
* of the working directory it is unpacked to.
|
||||
*/
|
||||
record Archive(String path, S3Uri location, String file, String directory) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code spark-submit} parameters given as one string, as EMR Serverless's
|
||||
* {@code sparkSubmitParameters}, split as a POSIX shell would split them: on whitespace, except inside single
|
||||
|
||||
@@ -61,13 +61,17 @@ public interface SparkJobRunner {
|
||||
* empty); how long it may run
|
||||
* ({@link Duration#ZERO} for no limit); the S3 folder its driver's {@code stdout.gz} and
|
||||
* {@code stderr.gz} go to once it ends, ending in a slash (null for none); where in CloudWatch Logs
|
||||
* its driver's output goes while it runs (null for nowhere but Floci's log); and the environment variables
|
||||
* its container gets besides Floci's own, which they replace where a name is the same (empty for none).
|
||||
* its driver's output goes while it runs (null for nowhere but Floci's log); the environment variables
|
||||
* its container gets besides Floci's own, which they replace where a name is the same (empty for none);
|
||||
* and its {@code spark.archives}, each a path with, after a {@code #}, the directory it is unpacked to,
|
||||
* of which those in S3 are unpacked into the container's working directory before the driver starts
|
||||
* (empty for none).
|
||||
*/
|
||||
record Job(String service, String runId, String accountId, String region, String releaseLabel,
|
||||
String imageTemplate, String customImage, String dockerNetwork, String executionRole,
|
||||
Map<String, String> sparkDefaults, List<String> application, List<String> command, Duration timeout,
|
||||
String logFolder, CloudWatchLogs cloudWatchLogs, Map<String, String> environment) {
|
||||
String logFolder, CloudWatchLogs cloudWatchLogs, Map<String, String> environment,
|
||||
List<String> archives) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user