mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -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
+66
@@ -264,6 +264,7 @@ class EmrServerlessJobRunServiceTest {
|
||||
assertNull(job.logFolder());
|
||||
assertNull(job.cloudWatchLogs());
|
||||
assertEquals(Map.of(), job.environment());
|
||||
assertEquals(List.of(), job.archives());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -666,6 +667,71 @@ class EmrServerlessJobRunServiceTest {
|
||||
EmrServerlessJobRunService.application(sparkSubmit));
|
||||
}
|
||||
|
||||
@Test
|
||||
void aRunsDriverEnvAndArchivesAreItsSparkPropertiesTheSubmitParametersWinning() {
|
||||
FakeRunner runner = new FakeRunner();
|
||||
EmrServerlessJobRunService service = dockerService(runner);
|
||||
RuntimeConfiguration defaults = new RuntimeConfiguration();
|
||||
defaults.setMember("classification", "spark-defaults");
|
||||
defaults.setMember("properties", Map.of(
|
||||
"spark.emr-serverless.driverEnv.JAVA_HOME", "/usr/lib/jvm/java-17-amazon-corretto.x86_64/",
|
||||
"spark.archives", "s3://bucket/envs/previous.tar.gz#environment"));
|
||||
CreateApplicationRequest create = applicationRequest("python", "emr-7.5.0", "SPARK");
|
||||
create.setRuntimeConfiguration(List.of(defaults));
|
||||
String python = applications.createApplication(create).getApplicationId();
|
||||
// The user guide's "Building a Python virtual environment".
|
||||
StartJobRunRequest request = request(null, null);
|
||||
request.getJobDriver().getSparkSubmit().setSparkSubmitParameters(String.join(" ",
|
||||
"--conf spark.archives=s3://bucket/envs/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"));
|
||||
|
||||
service.startJobRun(python, request);
|
||||
runNext();
|
||||
|
||||
SparkJobRunner.Job job = runner.jobs.get(0);
|
||||
assertEquals(Map.of("JAVA_HOME", "/usr/lib/jvm/java-17-amazon-corretto.x86_64/",
|
||||
"PYSPARK_DRIVER_PYTHON", "./environment/bin/python", "PYSPARK_PYTHON", "./environment/bin/python"),
|
||||
job.environment());
|
||||
assertEquals(List.of("s3://bucket/envs/pyspark_venv.tar.gz#environment"), job.archives());
|
||||
}
|
||||
|
||||
@Test
|
||||
void sparkPropertiesTakeEachFormOfConfASubmitGivesALaterOneWinning() {
|
||||
JobDriver.SparkSubmit sparkSubmit = new JobDriver.SparkSubmit();
|
||||
sparkSubmit.setSparkSubmitParameters("--conf spark.archives=s3://bucket/a.zip "
|
||||
+ "--conf='spark.archives= s3://bucket/b.tar.gz#b ,, s3://bucket/c.tgz' "
|
||||
+ "-c spark.emr-serverless.driverEnv.A=1=2 --conf spark.emr-serverless.driverEnv.=x "
|
||||
+ "--conf no-value --name spark.archives=ignored --conf");
|
||||
|
||||
Map<String, String> properties = EmrServerlessJobRunService.sparkProperties(
|
||||
Map.of("spark.executor.cores", "4"), sparkSubmit);
|
||||
|
||||
assertEquals(Map.of("spark.executor.cores", "4",
|
||||
"spark.archives", " s3://bucket/b.tar.gz#b ,, s3://bucket/c.tgz",
|
||||
"spark.emr-serverless.driverEnv.A", "1=2", "spark.emr-serverless.driverEnv.", "x"), properties);
|
||||
assertEquals(List.of("s3://bucket/b.tar.gz#b", "s3://bucket/c.tgz"),
|
||||
EmrServerlessJobRunService.archives(properties));
|
||||
assertEquals(Map.of("A", "1=2"), EmrServerlessJobRunService.driverEnvironment(properties));
|
||||
}
|
||||
|
||||
@Test
|
||||
void theLastArchivesOptionIsSparkArchivesWinningOverASettingOfItWhereverThatComes() {
|
||||
JobDriver.SparkSubmit sparkSubmit = new JobDriver.SparkSubmit();
|
||||
sparkSubmit.setSparkSubmitParameters("--archives s3://bucket/first.zip "
|
||||
+ "--archives=s3://bucket/envs/pyspark_venv.tar.gz#environment "
|
||||
+ "--conf spark.archives=s3://bucket/conf.zip");
|
||||
|
||||
Map<String, String> properties = EmrServerlessJobRunService.sparkProperties(
|
||||
Map.of("spark.archives", "s3://bucket/defaults.zip"), sparkSubmit);
|
||||
|
||||
assertEquals(Map.of("spark.archives", "s3://bucket/envs/pyspark_venv.tar.gz#environment"), properties);
|
||||
sparkSubmit.setSparkSubmitParameters("--conf spark.archives=s3://bucket/conf.zip --archives");
|
||||
assertEquals(Map.of("spark.archives", "s3://bucket/conf.zip"),
|
||||
EmrServerlessJobRunService.sparkProperties(Map.of(), sparkSubmit));
|
||||
}
|
||||
|
||||
private String applicationWithSparkDefaults(String releaseLabel) {
|
||||
RuntimeConfiguration defaults = new RuntimeConfiguration();
|
||||
defaults.setMember("classification", "spark-defaults");
|
||||
|
||||
+218
-3
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.emrserverless;
|
||||
|
||||
import com.github.dockerjava.api.DockerClient;
|
||||
import com.github.dockerjava.api.async.ResultCallback;
|
||||
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd;
|
||||
import com.github.dockerjava.api.exception.InternalServerErrorException;
|
||||
import com.github.dockerjava.api.model.Container;
|
||||
import com.github.dockerjava.api.model.Frame;
|
||||
@@ -15,29 +16,45 @@ import io.github.hectorvent.floci.core.common.docker.ContainerLogStreamer;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerStorageHelper;
|
||||
import io.github.hectorvent.floci.core.common.docker.LaunchedContainerAwsEnv;
|
||||
import io.github.hectorvent.floci.services.ecr.registry.EcrRegistryManager;
|
||||
import io.github.hectorvent.floci.services.lambda.launcher.BootstrapProcess;
|
||||
import io.github.hectorvent.floci.services.lambda.launcher.ImageCacheService.LaunchImage;
|
||||
import io.github.hectorvent.floci.services.lambda.launcher.LambdaExecutionRoleCredentials;
|
||||
import io.github.hectorvent.floci.services.s3.S3Service;
|
||||
import io.github.hectorvent.floci.services.s3.model.S3Object;
|
||||
import io.github.hectorvent.floci.testing.MutableClock;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.InOrder;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.StringReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
@@ -215,6 +232,170 @@ class EmrServerlessSparkRunnerTest {
|
||||
EmrServerlessSparkRunner.environment(List.of("AWS_REGION=eu-west-1"), Map.of()));
|
||||
}
|
||||
|
||||
@Test
|
||||
void anArchiveInS3IsPutInTheContainerAndUnpackedIntoTheWorkingDirectoryBeforeTheDriverStarts() {
|
||||
ContainerBuilder builder = mock(ContainerBuilder.class);
|
||||
ContainerBuilder.Builder spec = mock(ContainerBuilder.Builder.class, RETURNS_SELF);
|
||||
when(builder.newContainer(anyString())).thenReturn(spec);
|
||||
EmrServerlessSparkRunner runner = runner(builder);
|
||||
CopyArchiveToContainerCmd copy = mock(CopyArchiveToContainerCmd.class, RETURNS_SELF);
|
||||
when(docker.copyArchiveToContainerCmd("driver")).thenReturn(copy);
|
||||
Map<String, String> copied = copiedIn(copy);
|
||||
inS3("bucket", "envs/pyspark_venv.tar.gz", "a virtual environment");
|
||||
inS3("bucket", "libs/deps.zip", "some libraries");
|
||||
|
||||
runner.run(archiveJob(List.of("s3://bucket/envs/pyspark_venv.tar.gz#environment", "s3a://bucket/libs/deps.zip",
|
||||
"file:///opt/local.tar.gz#local")), progress);
|
||||
|
||||
// The guide's virtual environment by the name after its "#", one without a "#" by its file's; Spark alone
|
||||
// unpacks one outside S3.
|
||||
verify(spec).withEntrypoint(argThat(entrypoint -> entrypoint.subList(0, 2).equals(List.of("/bin/bash", "-c"))
|
||||
&& entrypoint.get(2).contains("tar -xf") && entrypoint.subList(3, entrypoint.size()).equals(List.of(
|
||||
"floci", "/tmp/floci-archives/1/pyspark_venv.tar.gz", "environment",
|
||||
"/tmp/floci-archives/2/deps.zip", "deps.zip", "--", "/usr/lib/spark/bin/spark-submit"))));
|
||||
verify(spec).withCmd(argThat((List<String> cmd) -> "s3://bucket/jobs/app.jar".equals(cmd.getLast())));
|
||||
// Each streamed into the created container, extracted at its root.
|
||||
assertEquals(Map.of("tmp/floci-archives/1/pyspark_venv.tar.gz", "a virtual environment",
|
||||
"tmp/floci-archives/2/deps.zip", "some libraries"), copied);
|
||||
InOrder order = inOrder(lifecycle, copy);
|
||||
order.verify(lifecycle).create(any());
|
||||
order.verify(copy, times(2)).withRemotePath("/");
|
||||
order.verify(lifecycle).startCreated(eq("driver"), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void anArchiveThatCannotBeReadFailsTheRunNamingItAndNeverStartsItsDriver() {
|
||||
EmrServerlessSparkRunner runner = runner();
|
||||
when(s3.headObject("bucket", "envs/missing.tar.gz"))
|
||||
.thenThrow(new AwsException("NoSuchKey", "The specified key does not exist.", 404));
|
||||
|
||||
SparkJobRunner.Outcome outcome = runner.run(
|
||||
archiveJob(List.of("s3://bucket/envs/missing.tar.gz#environment")), progress);
|
||||
|
||||
assertEquals("Could not read the archive s3://bucket/envs/missing.tar.gz: The specified key does not exist.",
|
||||
outcome.failure());
|
||||
verify(lifecycle, never()).startCreated(anyString(), any());
|
||||
verify(lifecycle).stopAndRemove("driver", null, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void aRunStoppedWhileItsImageIsPulledPutsInNoArchiveAndNeverStartsItsDriver() {
|
||||
EmrServerlessSparkRunner runner = runner();
|
||||
SparkJobRunner.Job job = archiveJob(List.of("s3://bucket/envs/pyspark_venv.tar.gz#environment"));
|
||||
inS3("bucket", "envs/pyspark_venv.tar.gz", "a virtual environment");
|
||||
when(lifecycle.create(any())).thenAnswer(pulling -> {
|
||||
runner.stop(job.runId());
|
||||
return "driver";
|
||||
});
|
||||
|
||||
SparkJobRunner.Outcome outcome = runner.run(job, progress);
|
||||
|
||||
assertTrue(outcome.stopped());
|
||||
verify(s3, never()).openObject(anyString(), anyString(), any());
|
||||
verify(docker, never()).copyArchiveToContainerCmd(anyString());
|
||||
verify(lifecycle, never()).startCreated(anyString(), any());
|
||||
verify(lifecycle).stopAndRemove("driver", null, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void aCancelWhileAnArchiveStreamsInEndsItsCopyAndPutsInNoOther() {
|
||||
EmrServerlessSparkRunner runner = runner();
|
||||
inS3("bucket", "libs/deps.zip", "some libraries");
|
||||
// A 1 GiB archive, the run cancelled once its first bytes are read.
|
||||
long size = 1L << 30;
|
||||
AtomicLong served = new AtomicLong();
|
||||
InputStream body = new InputStream() {
|
||||
@Override
|
||||
public int read() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int length) {
|
||||
int read = (int) Math.min(length, size - served.get());
|
||||
if (read == 0) {
|
||||
return -1;
|
||||
}
|
||||
served.addAndGet(read);
|
||||
return read;
|
||||
}
|
||||
};
|
||||
when(s3.openObject("bucket", "envs/large.tar.gz", null)).thenReturn(new S3Service.ObjectRead(
|
||||
new S3Object("bucket", "envs/large.tar.gz", size, "application/gzip", null), body));
|
||||
when(progress.cancelled()).thenAnswer(look -> served.get() > 0);
|
||||
CopyArchiveToContainerCmd copy = mock(CopyArchiveToContainerCmd.class, RETURNS_SELF);
|
||||
when(docker.copyArchiveToContainerCmd("driver")).thenReturn(copy);
|
||||
when(copy.withTarInputStream(any())).thenAnswer(streaming -> {
|
||||
// Read to its end, as the daemon does.
|
||||
streaming.<InputStream>getArgument(0).transferTo(OutputStream.nullOutputStream());
|
||||
return copy;
|
||||
});
|
||||
|
||||
SparkJobRunner.Outcome outcome = runner.run(
|
||||
archiveJob(List.of("s3://bucket/envs/large.tar.gz#environment", "s3://bucket/libs/deps.zip")),
|
||||
progress);
|
||||
|
||||
assertTrue(outcome.stopped());
|
||||
assertTrue(served.get() < 16L << 20, served.get() + " bytes were read");
|
||||
verify(s3, never()).openObject("bucket", "libs/deps.zip", null);
|
||||
verify(lifecycle, never()).startCreated(anyString(), any());
|
||||
verify(lifecycle).stopAndRemove("driver", null, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void aJobWithoutArchivesInS3StartsSparkSubmitItself() {
|
||||
assertEquals(List.of("/usr/lib/spark/bin/spark-submit"), EmrServerlessSparkRunner.unpackingFirst(
|
||||
EmrServerlessSparkRunner.archives(archiveJob(List.of("https://example.com/env.tar.gz#environment"))),
|
||||
List.of("/usr/lib/spark/bin/spark-submit")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void theWrapperUnpacksEachArchiveAsSparkDoesThenRunsWhatFollows(@TempDir Path directory) throws Exception {
|
||||
Path environment = directory.resolve("pyspark_venv.TAR.GZ");
|
||||
try (TarArchiveOutputStream tar = new TarArchiveOutputStream(
|
||||
new GZIPOutputStream(Files.newOutputStream(environment)))) {
|
||||
byte[] python = bytes("#!/bin/sh\necho python\n");
|
||||
TarArchiveEntry entry = new TarArchiveEntry("bin/python");
|
||||
entry.setSize(python.length);
|
||||
entry.setMode(0755);
|
||||
tar.putArchiveEntry(entry);
|
||||
tar.write(python);
|
||||
tar.closeArchiveEntry();
|
||||
}
|
||||
Path libraries = directory.resolve("deps.zip");
|
||||
try (ZipOutputStream zip = new ZipOutputStream(Files.newOutputStream(libraries))) {
|
||||
zip.putNextEntry(new ZipEntry("lib/helpers.py"));
|
||||
zip.write(bytes("helpers"));
|
||||
zip.closeEntry();
|
||||
}
|
||||
Path notes = directory.resolve("notes.txt");
|
||||
Files.writeString(notes, "notes");
|
||||
Path workingDirectory = Files.createDirectory(directory.resolve("home"));
|
||||
String script = "./environment/bin/python; cat deps.zip/lib/helpers.py readme; echo \" $1\"";
|
||||
List<String> entrypoint = EmrServerlessSparkRunner.unpackingFirst(List.of(
|
||||
archive(environment, "environment"), archive(libraries, "deps.zip"), archive(notes, "readme")),
|
||||
List.of("sh", "-c", script, "sh"));
|
||||
List<String> command = new ArrayList<>(entrypoint);
|
||||
command.add("argument");
|
||||
|
||||
BootstrapProcess.Result ended = BootstrapProcess.run(new ProcessBuilder(command).directory(
|
||||
workingDirectory.toFile()));
|
||||
|
||||
assertEquals(new BootstrapProcess.Result(0, "python\nhelpersnotes argument\n"), ended);
|
||||
}
|
||||
|
||||
@Test
|
||||
void anArchiveThatDoesNotUnpackStopsTheDriverFromStarting(@TempDir Path directory) throws Exception {
|
||||
Path broken = Files.writeString(directory.resolve("broken.tar.gz"), "not an archive");
|
||||
List<String> command = EmrServerlessSparkRunner.unpackingFirst(List.of(archive(broken, "environment")),
|
||||
List.of("echo", "started"));
|
||||
|
||||
BootstrapProcess.Result ended = BootstrapProcess.run(new ProcessBuilder(command).directory(directory.toFile()));
|
||||
|
||||
assertTrue(ended.exit() != 0);
|
||||
assertFalse(ended.output().contains("started"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void aCommandsOwnSparkSubmitRunsLocallyOnFlocisS3WithTheJobsSparkDefaults() {
|
||||
assertEquals(String.join("\n",
|
||||
@@ -583,6 +764,34 @@ class EmrServerlessSparkRunnerTest {
|
||||
}
|
||||
}
|
||||
|
||||
// What each tar copied into the container holds, by entry, read as the daemon reads it.
|
||||
private static Map<String, String> copiedIn(CopyArchiveToContainerCmd copy) {
|
||||
Map<String, String> copied = new LinkedHashMap<>();
|
||||
when(copy.withTarInputStream(any())).thenAnswer(streaming -> {
|
||||
InputStream stream = streaming.getArgument(0);
|
||||
TarArchiveInputStream tar = new TarArchiveInputStream(stream);
|
||||
for (TarArchiveEntry entry = tar.getNextEntry(); entry != null; entry = tar.getNextEntry()) {
|
||||
copied.put(entry.getName(), new String(tar.readAllBytes(), StandardCharsets.UTF_8));
|
||||
}
|
||||
// Read to its end, as the daemon does, so the writer finishes; the copy closes the stream.
|
||||
stream.transferTo(OutputStream.nullOutputStream());
|
||||
return copy;
|
||||
});
|
||||
return copied;
|
||||
}
|
||||
|
||||
// An object in Floci's S3, which each read opens afresh.
|
||||
private void inS3(String bucket, String key, String content) {
|
||||
S3Object object = new S3Object(bucket, key, bytes(content), "application/octet-stream");
|
||||
when(s3.openObject(bucket, key, null))
|
||||
.thenAnswer(read -> new S3Service.ObjectRead(object, new ByteArrayInputStream(object.getData())));
|
||||
}
|
||||
|
||||
// An archive at file, a path on this host, to be unpacked into directory.
|
||||
private static EmrServerlessSparkRunner.Archive archive(Path file, String directory) {
|
||||
return new EmrServerlessSparkRunner.Archive(null, null, file.toString(), directory);
|
||||
}
|
||||
|
||||
private static byte[] bytes(String text) {
|
||||
return text.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
@@ -626,18 +835,24 @@ class EmrServerlessSparkRunnerTest {
|
||||
SparkJobRunner.CloudWatchLogs cloudWatchLogs) {
|
||||
return new SparkJobRunner.Job("emr-serverless", "00f0000000000001", "123456789012", "eu-west-1", "emr-7.5.0",
|
||||
imageTemplate, null, "floci-network", "arn:aws:iam::123456789012:role/job", sparkDefaults,
|
||||
application, null, timeout, logFolder, cloudWatchLogs, Map.of());
|
||||
application, null, timeout, logFolder, cloudWatchLogs, Map.of(), List.of());
|
||||
}
|
||||
|
||||
private static SparkJobRunner.Job customImageJob(String customImage) {
|
||||
return new SparkJobRunner.Job("emr-serverless", "00f0000000000001", "123456789012", "eu-west-1", "emr-7.5.0",
|
||||
null, customImage, "floci-network", "arn:aws:iam::123456789012:role/job", Map.of(),
|
||||
List.of("s3://bucket/jobs/app.jar"), null, Duration.ZERO, null, null, Map.of());
|
||||
List.of("s3://bucket/jobs/app.jar"), null, Duration.ZERO, null, null, Map.of(), List.of());
|
||||
}
|
||||
|
||||
private static SparkJobRunner.Job archiveJob(List<String> archives) {
|
||||
return new SparkJobRunner.Job("emr-serverless", "00f0000000000001", "123456789012", "eu-west-1", "emr-7.5.0",
|
||||
null, null, "floci-network", "arn:aws:iam::123456789012:role/job", Map.of(),
|
||||
List.of("s3://bucket/jobs/app.jar"), null, Duration.ZERO, null, null, Map.of(), archives);
|
||||
}
|
||||
|
||||
private static SparkJobRunner.Job commandJob(List<String> command, Map<String, String> sparkDefaults) {
|
||||
return new SparkJobRunner.Job("emr", "s-1A2B3C4D5E6F7", "123456789012", "eu-west-1", "emr-7.5.0", null,
|
||||
null, "floci-network", "arn:aws:iam::123456789012:role/job", sparkDefaults, List.of(), command,
|
||||
Duration.ZERO, null, null, Map.of("PYSPARK_PYTHON", "/usr/bin/python3.11"));
|
||||
Duration.ZERO, null, null, Map.of("PYSPARK_PYTHON", "/usr/bin/python3.11"), List.of());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user