mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(emr): apply MERGE reconfigurations, step log locations, the scaling index and ServerUrl (#9129)
Four members EMR accepted and ignored now act as AWS documents them. ModifyInstanceGroups' ReconfigurationType MERGE merges the group's new Configurations into its own, as the Release Guide's "Reconfigure an instance group in a running cluster" has it: "This option only adds or modifies the new configurations that you submit. It preserves existing configurations." A classification it names takes its properties over the group's, nested configurations merged the same way, and the others stay; OVERWRITE, the default, still replaces them. MERGE is "supported for Amazon EMR releases 5.35.0 and 6.6.0 and later", so an earlier release refuses it with ValidationException, in Floci's wording, and a type that is neither gets the framework's enum message. A step's StepMonitoringConfiguration sends its logs, and its applications' container logs, to its own LogUri from release 7.11, as its options "take precedence over any cluster-wide logging settings", still only on a cluster with a LogUri. The guide gives no layout under the step's destination, so it is the cluster's. A node removed while such steps run puts its containers' logs there when they share one. DescribeStep and ListSteps give the step's LogUri and EncryptionKeyArn back. A managed scaling policy's UtilizationPerformanceIndex is one of 1, 25, 50, 75 and 100: "If you set the index to values other than these, it results in a validation error." One outside the model's 1 to 100 gets the framework's ValidationException, another Floci's wording. A session whose Spark Connect server answers reports ServerUrl, Floci's own address in Spark Connect's sc:// form, where a call still needs GetSessionEndpoint's token to reach the server; an ended session has none.
This commit is contained in:
1 parent
d22ea96ecf
commit
7ae2339100
14 files changed
+411
-12
No files matched your search
@@ -405,6 +405,7 @@ public class EmrHandler {
|
||||
setRawJson(node, "EngineConfigurations", session.getEngineConfigurations());
|
||||
setRawJson(node, "MonitoringConfiguration", session.getMonitoringConfiguration());
|
||||
node.put("SessionIdleTimeoutInMinutes", session.getSessionIdleTimeoutInMinutes());
|
||||
putIfSet(node, "ServerUrl", session.getServerUrl());
|
||||
node.set("Tags", tagArray(session.getTags()));
|
||||
return node;
|
||||
}
|
||||
@@ -1279,7 +1280,8 @@ public class EmrHandler {
|
||||
modifications.add(new EmrService.InstanceGroupModification(
|
||||
g.path("InstanceGroupId").asText(null),
|
||||
count.isMissingNode() || count.isNull() ? null : count.asInt(),
|
||||
configurations.isArray() ? configurations.toString() : null));
|
||||
configurations.isArray() ? configurations.toString() : null,
|
||||
g.path("ReconfigurationType").asText(null)));
|
||||
}
|
||||
}
|
||||
service.modifyInstanceGroups(text(request, "ClusterId"), region, modifications);
|
||||
@@ -1490,6 +1492,9 @@ public class EmrHandler {
|
||||
if (includeExecutionRole && step.getExecutionRoleArn() != null) {
|
||||
node.put("ExecutionRoleArn", step.getExecutionRoleArn());
|
||||
}
|
||||
// Its own log destination and key, the StepMonitoringConfiguration it was given.
|
||||
putIfSet(node, "LogUri", step.getLogUri());
|
||||
putIfSet(node, "EncryptionKeyArn", step.getEncryptionKeyArn());
|
||||
ObjectNode status = node.putObject("Status");
|
||||
status.put("State", step.getState());
|
||||
if (step.getStateChangeReason() != null) {
|
||||
@@ -1697,6 +1702,9 @@ public class EmrHandler {
|
||||
props.forEach(p -> map.put(p.path("Key").asText(), p.path("Value").asText()));
|
||||
step.setProperties(map);
|
||||
}
|
||||
JsonNode s3Logs = s.path("StepMonitoringConfiguration").path("S3MonitoringConfiguration");
|
||||
step.setLogUri(s3Logs.path("LogUri").asText(null));
|
||||
step.setEncryptionKeyArn(s3Logs.path("EncryptionKeyArn").asText(null));
|
||||
steps.add(step);
|
||||
}
|
||||
return steps;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import io.floci.aws.config.EmulatorConfig;
|
||||
@@ -54,6 +55,7 @@ import jakarta.inject.Inject;
|
||||
import jakarta.inject.Provider;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.net.URI;
|
||||
import java.security.SecureRandom;
|
||||
import java.time.Clock;
|
||||
import java.time.Duration;
|
||||
@@ -230,6 +232,11 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
|
||||
private static final Set<String> COMPUTE_LIMITS_UNIT_TYPES = Set.of("InstanceFleetUnits", "Instances", "VCPU");
|
||||
private static final Set<String> SCALING_STRATEGIES = Set.of("DEFAULT", "ADVANCED");
|
||||
private static final int MIN_PERFORMANCE_INDEX = 1;
|
||||
private static final int MAX_PERFORMANCE_INDEX = 100;
|
||||
private static final List<Integer> PERFORMANCE_INDEXES = List.of(1, 25, 50, 75, 100);
|
||||
private static final String MERGE = "MERGE";
|
||||
private static final List<String> RECONFIGURATION_TYPES = List.of("OVERWRITE", MERGE);
|
||||
private static final long MIN_IDLE_TIMEOUT_SECONDS = 60;
|
||||
private static final long MAX_IDLE_TIMEOUT_SECONDS = 604_800;
|
||||
// StepConcurrencyLevel: "You can specify a minimum of 1 step and a maximum of 256 steps" (ModifyCluster), "The
|
||||
@@ -1357,6 +1364,20 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
sessionStore.put(stored.getId(), stored);
|
||||
}
|
||||
|
||||
/**
|
||||
* The session's ServerUrl, "The Spark Connect server URL for the session", which a client uses "with the
|
||||
* Credentials returned by GetSessionEndpoint to connect directly to the session": Floci's own address in Spark
|
||||
* Connect's {@code sc://} form, where {@link SparkConnectProxy} takes a call carrying GetSessionEndpoint's token
|
||||
* on to the session's server, so that no client reaches the server without one. The model gives no example of
|
||||
* AWS's.
|
||||
*/
|
||||
@Override
|
||||
protected void ready(EmrSession stored) {
|
||||
URI base = URI.create(baseUrl);
|
||||
int port = base.getPort() != -1 ? base.getPort() : "https".equals(base.getScheme()) ? 443 : 80;
|
||||
stored.setServerUrl("sc://" + base.getHost() + ":" + port);
|
||||
}
|
||||
|
||||
// The reason it has, as TerminateSession or its cluster's end gave it.
|
||||
@Override
|
||||
protected String endReason(EmrSession stored, SparkJobRunner.Outcome outcome) {
|
||||
@@ -1408,8 +1429,17 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
});
|
||||
}
|
||||
|
||||
/** One InstanceGroupModifyConfig: a null count or configurations leaves that setting as it is. */
|
||||
public record InstanceGroupModification(String instanceGroupId, Integer instanceCount, String configurations) {}
|
||||
/**
|
||||
* One InstanceGroupModifyConfig: a null count or configurations leaves that setting as it is, and a null
|
||||
* reconfiguration type is OVERWRITE.
|
||||
*/
|
||||
public record InstanceGroupModification(String instanceGroupId, Integer instanceCount, String configurations,
|
||||
String reconfigurationType) {
|
||||
|
||||
public InstanceGroupModification(String instanceGroupId, Integer instanceCount, String configurations) {
|
||||
this(instanceGroupId, instanceCount, configurations, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes or reconfigures instance groups in place. ClusterId is optional in the request, so
|
||||
@@ -1423,7 +1453,8 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
}
|
||||
Map<String, EmrCluster> touched = new LinkedHashMap<>();
|
||||
List<EmrInstanceGroup> groups = new ArrayList<>();
|
||||
for (InstanceGroupModification mod : modifications) {
|
||||
for (int position = 1; position <= modifications.size(); position++) {
|
||||
InstanceGroupModification mod = modifications.get(position - 1);
|
||||
EmrCluster found = clusterId != null
|
||||
? requireCluster(clusterId) : clusterOwning(region, mod.instanceGroupId());
|
||||
// AWS's answer here, recorded by Terraform users
|
||||
@@ -1435,6 +1466,7 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
// One copy per cluster, so two groups of the same cluster are changed and stored together.
|
||||
EmrCluster cluster = touched.computeIfAbsent(found.getId(), id -> found);
|
||||
EmrInstanceGroup group = requireInstanceGroup(cluster, mod.instanceGroupId());
|
||||
checkReconfigurationType(mod.reconfigurationType(), position, cluster.getReleaseLabel());
|
||||
if (mod.instanceCount() != null) {
|
||||
if (mod.instanceCount() < 0) {
|
||||
throw invalid("InstanceCount must not be negative.");
|
||||
@@ -1454,7 +1486,9 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
group.setRunningInstanceCount(mod.instanceCount());
|
||||
}
|
||||
if (mod.configurations() != null) {
|
||||
group.setConfigurations(mod.configurations());
|
||||
group.setConfigurations(MERGE.equals(mod.reconfigurationType())
|
||||
? mergedConfigurations(group.getConfigurations(), mod.configurations())
|
||||
: mod.configurations());
|
||||
group.setConfigurationsVersion(group.getConfigurationsVersion() + 1);
|
||||
}
|
||||
}
|
||||
@@ -1463,6 +1497,74 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* A reconfiguration type is OVERWRITE or MERGE, the model's enum. MERGE is "supported for Amazon EMR releases
|
||||
* 5.35.0 and 6.6.0 and later", and OVERWRITE is "the only one available in Amazon EMR releases earlier than 5.35.0
|
||||
* and 6.6.0" (Release Guide, "Reconfigure an instance group in a running cluster"). No source gives AWS's refusal
|
||||
* of MERGE on an earlier release, so its wording is Floci's.
|
||||
*/
|
||||
private static void checkReconfigurationType(String type, int position, String releaseLabel) {
|
||||
if (type == null) {
|
||||
return;
|
||||
}
|
||||
if (!RECONFIGURATION_TYPES.contains(type)) {
|
||||
throw SmithyValidationErrors.validationException(SmithyValidationErrors.notInEnum(type,
|
||||
"instanceGroups." + position + ".member.reconfigurationType", RECONFIGURATION_TYPES));
|
||||
}
|
||||
boolean merges = releaseAtLeast(releaseLabel, 6, 6, 0)
|
||||
|| (releaseAtLeast(releaseLabel, 5, 35, 0) && !releaseAtLeast(releaseLabel, 6, 0, 0));
|
||||
if (MERGE.equals(type) && !merges) {
|
||||
throw new AwsException("ValidationException", "MERGE reconfiguration is supported for Amazon EMR releases"
|
||||
+ " 5.35.0 and 6.6.0 and later, and the cluster runs " + releaseLabel + ".", 400);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An instance group's configurations after a MERGE reconfiguration: it "merges the newly submitted configurations
|
||||
* with configurations that already exist on the cluster. This option only adds or modifies the new configurations
|
||||
* that you submit. It preserves existing configurations." A classification it names takes its properties over the
|
||||
* existing ones of that classification, and its nested configurations merged the same way; one it does not name
|
||||
* stays, and a new one is added.
|
||||
*/
|
||||
static String mergedConfigurations(String existing, String added) {
|
||||
try {
|
||||
ArrayNode merged = existing != null && SNAPSHOT_MAPPER.readTree(existing) instanceof ArrayNode held
|
||||
? held : SNAPSHOT_MAPPER.createArrayNode();
|
||||
return merged(merged, (ArrayNode) SNAPSHOT_MAPPER.readTree(added)).toString();
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new IllegalStateException("Stored configurations are not JSON", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static ArrayNode merged(ArrayNode existing, ArrayNode added) {
|
||||
ArrayNode merged = existing.deepCopy();
|
||||
for (JsonNode configuration : added) {
|
||||
String classification = configuration.path("Classification").asText(null);
|
||||
ObjectNode match = null;
|
||||
for (JsonNode held : merged) {
|
||||
if (classification != null && held instanceof ObjectNode object
|
||||
&& classification.equals(held.path("Classification").asText(null))) {
|
||||
match = object;
|
||||
}
|
||||
}
|
||||
if (match == null || !configuration.isObject()) {
|
||||
merged.add(configuration.deepCopy());
|
||||
continue;
|
||||
}
|
||||
if (configuration.path("Properties").isObject()) {
|
||||
JsonNode properties = match.path("Properties");
|
||||
ObjectNode into = properties.isObject() ? (ObjectNode) properties : match.putObject("Properties");
|
||||
into.setAll((ObjectNode) configuration.get("Properties").deepCopy());
|
||||
}
|
||||
if (configuration.path("Configurations").isArray()) {
|
||||
JsonNode nested = match.path("Configurations");
|
||||
match.set("Configurations", merged(nested.isArray() ? (ArrayNode) nested
|
||||
: SNAPSHOT_MAPPER.createArrayNode(), (ArrayNode) configuration.get("Configurations")));
|
||||
}
|
||||
}
|
||||
return merged;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String namespace() {
|
||||
return "elasticmapreduce";
|
||||
@@ -2042,6 +2144,31 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
if (!strategy.isMissingNode() && !SCALING_STRATEGIES.contains(strategy.asText(""))) {
|
||||
throw invalid("ScalingStrategy must be one of " + SCALING_STRATEGIES + ".");
|
||||
}
|
||||
checkUtilizationPerformanceIndex(policy.path("UtilizationPerformanceIndex"));
|
||||
}
|
||||
|
||||
/**
|
||||
* The model bounds UtilizationPerformanceIndex to 1 to 100, and of those "Possible values are 1, 25, 50, 75 and
|
||||
* 100. If you set the index to values other than these, it results in a validation error" (Management Guide,
|
||||
* "Advanced Scaling for Amazon EMR"). The guide gives no message for the latter, so its wording is Floci's.
|
||||
*/
|
||||
private static void checkUtilizationPerformanceIndex(JsonNode index) {
|
||||
if (index.isMissingNode() || index.isNull()) {
|
||||
return;
|
||||
}
|
||||
String path = "managedScalingPolicy.utilizationPerformanceIndex";
|
||||
if (!index.isIntegralNumber() || !index.canConvertToInt()) {
|
||||
throw invalid("ManagedScalingPolicy.UtilizationPerformanceIndex must be an integer.");
|
||||
}
|
||||
String range = SmithyValidationErrors.outOfRange(path, index.intValue(), MIN_PERFORMANCE_INDEX,
|
||||
MAX_PERFORMANCE_INDEX);
|
||||
if (range != null) {
|
||||
throw SmithyValidationErrors.validationException(range);
|
||||
}
|
||||
if (!PERFORMANCE_INDEXES.contains(index.intValue())) {
|
||||
throw new AwsException("ValidationException", "UtilizationPerformanceIndex must be one of "
|
||||
+ PERFORMANCE_INDEXES + ".", 400);
|
||||
}
|
||||
}
|
||||
|
||||
/** IdleTimeout, when given, is 60 to 604800 seconds. */
|
||||
@@ -2775,7 +2902,7 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
StepLaunch launch = new StepLaunch(accountId, region, cluster.getId(), step.getId(), generation,
|
||||
teardowns.get());
|
||||
executing.add(stepKey(accountId, step.getId()));
|
||||
String containerLogs = yarn ? EmrSparkSteps.containerLogFolder(cluster) : null;
|
||||
String containerLogs = yarn ? EmrSparkSteps.containerLogFolder(cluster, step) : null;
|
||||
stepExecutor.execute(() -> runStep(job, launch, onCluster.releaseImage(), onCluster.hdfs(), containerLogs,
|
||||
onCluster.primary()));
|
||||
}
|
||||
@@ -3010,7 +3137,7 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
long coreNodes = nodes.stream().filter(ClusterStorage.Node::core).count();
|
||||
return nodeManager.withHadoopFolder(EmrReleaseImages.hadoopFolder(cluster.getReleaseLabel()))
|
||||
.onNodes(nodes, (int) Math.max(1, Math.min(replication(cluster), coreNodes)),
|
||||
EmrSparkSteps.containerLogFolder(cluster))
|
||||
EmrSparkSteps.nodeLogFolder(cluster))
|
||||
.withPrimaryWorking(cluster.getProvisionedCoreNodes() == 0 || coreNodes == 0)
|
||||
.withSparkHistory(EmrSparkSteps.names(cluster.getApplications(), SNAPSHOT_MAPPER, "Spark"))
|
||||
.withHistories(timeline, timeline && tezImage
|
||||
|
||||
@@ -273,6 +273,8 @@ final class EmrSessions {
|
||||
session.setEndedAt(at);
|
||||
session.setUpdatedAt(at);
|
||||
session.setIdleSince(null);
|
||||
// Its server has gone, and with it the URL to reach it at.
|
||||
session.setServerUrl(null);
|
||||
}
|
||||
|
||||
/** Whether the session has ended, TERMINATED or FAILED. */
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.io.InputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -329,16 +330,58 @@ final class EmrSparkSteps {
|
||||
return EmrServerlessSparkRunner.logFolder(cluster.getLogUri(), cluster.getId() + "/containers/");
|
||||
}
|
||||
|
||||
/**
|
||||
* The S3 folder a step's application container logs go to: its own log destination's {@code containers} folder,
|
||||
* as "the application's container logs will also be uploaded to the location specified in the
|
||||
* StepMonitoringConfiguration", where it has one ({@link #logUri}), and else its cluster's.
|
||||
*/
|
||||
static String containerLogFolder(EmrCluster cluster, EmrStep step) {
|
||||
return EmrServerlessSparkRunner.logFolder(logUri(cluster, step), cluster.getId() + "/containers/");
|
||||
}
|
||||
|
||||
/**
|
||||
* Where a node removed from the cluster puts its containers' logs: the running steps' own destination when they
|
||||
* share one, as those logs are their applications', and else the cluster's. A node removed between steps, or while
|
||||
* steps with other destinations run, uses the cluster's.
|
||||
*/
|
||||
static String nodeLogFolder(EmrCluster cluster) {
|
||||
Set<String> folders = new HashSet<>();
|
||||
String folder = containerLogFolder(cluster);
|
||||
for (EmrStep step : cluster.getSteps()) {
|
||||
if (EmrClusterLifecycle.RUNNING.equals(step.getState())
|
||||
|| EmrClusterLifecycle.CANCEL_PENDING.equals(step.getState())) {
|
||||
folder = containerLogFolder(cluster, step);
|
||||
folders.add(String.valueOf(folder));
|
||||
}
|
||||
}
|
||||
return folders.size() == 1 ? folder : containerLogFolder(cluster);
|
||||
}
|
||||
|
||||
/**
|
||||
* The S3 folder a step's logs go to, or null when its cluster has no {@code LogUri}: "If a value is not
|
||||
* provided, logs are not created". The Management Guide's "Log locations" puts step logs at
|
||||
* {@code <LogUri>/<cluster-id>/steps/<step-id>/}.
|
||||
* {@code <LogUri>/<cluster-id>/steps/<step-id>/}, under the step's own destination where it has one.
|
||||
*/
|
||||
static String logFolder(EmrCluster cluster, EmrStep step) {
|
||||
return EmrServerlessSparkRunner.logFolder(cluster.getLogUri(),
|
||||
return EmrServerlessSparkRunner.logFolder(logUri(cluster, step),
|
||||
cluster.getId() + "/steps/" + step.getId() + "/");
|
||||
}
|
||||
|
||||
/**
|
||||
* Where a step's logs are published: the {@code LogUri} of its StepMonitoringConfiguration, which "Beginning in
|
||||
* Amazon EMR version 7.11" "take[s] precedence over any cluster-wide logging settings", and else its cluster's.
|
||||
* None without the cluster's: "If your cluster does not enable cluster logging, step logs will not be uploaded to
|
||||
* S3 even if you provide a StepMonitoringConfiguration" (Management Guide, "Customizing the log location for step
|
||||
* log files"). The guide gives no folder layout under the step's own destination; it is the cluster's.
|
||||
*/
|
||||
static String logUri(EmrCluster cluster, EmrStep step) {
|
||||
if (cluster.getLogUri() == null || step.getLogUri() == null
|
||||
|| !EmrService.releaseAtLeast(cluster.getReleaseLabel(), 7, 11, 0)) {
|
||||
return cluster.getLogUri();
|
||||
}
|
||||
return step.getLogUri();
|
||||
}
|
||||
|
||||
/**
|
||||
* The Spark properties of a cluster's {@code Configurations}, the JSON array {@code RunJobFlow} was given,
|
||||
* that a step's {@code spark-submit} gets as defaults: {@code spark-defaults}'s, and {@code core-site}'s and
|
||||
|
||||
@@ -31,6 +31,8 @@ public class EmrSession implements SparkConnectSession {
|
||||
private Instant startedAt;
|
||||
private Instant endedAt;
|
||||
private Instant idleSince;
|
||||
// The Spark Connect server URL, once its server answers.
|
||||
private String serverUrl;
|
||||
private String engineConfigurations;
|
||||
private String monitoringConfiguration;
|
||||
private long sessionIdleTimeoutInMinutes;
|
||||
@@ -70,6 +72,8 @@ public class EmrSession implements SparkConnectSession {
|
||||
public void setStartedAt(Instant startedAt) { this.startedAt = startedAt; }
|
||||
public Instant getEndedAt() { return endedAt; }
|
||||
public void setEndedAt(Instant endedAt) { this.endedAt = endedAt; }
|
||||
public String getServerUrl() { return serverUrl; }
|
||||
public void setServerUrl(String serverUrl) { this.serverUrl = serverUrl; }
|
||||
public Instant getIdleSince() { return idleSince; }
|
||||
public void setIdleSince(Instant idleSince) { this.idleSince = idleSince; }
|
||||
public String getEngineConfigurations() { return engineConfigurations; }
|
||||
|
||||
@@ -25,6 +25,9 @@ public class EmrStep {
|
||||
private String state;
|
||||
private String stateChangeReason;
|
||||
private String executionRoleArn;
|
||||
// Its StepMonitoringConfiguration's S3MonitoringConfiguration, null where it gives none.
|
||||
private String logUri;
|
||||
private String encryptionKeyArn;
|
||||
private boolean runInContainer;
|
||||
private String failureReason;
|
||||
private String failureMessage;
|
||||
@@ -64,6 +67,12 @@ public class EmrStep {
|
||||
public String getExecutionRoleArn() { return executionRoleArn; }
|
||||
public void setExecutionRoleArn(String executionRoleArn) { this.executionRoleArn = executionRoleArn; }
|
||||
|
||||
public String getLogUri() { return logUri; }
|
||||
public void setLogUri(String logUri) { this.logUri = logUri; }
|
||||
|
||||
public String getEncryptionKeyArn() { return encryptionKeyArn; }
|
||||
public void setEncryptionKeyArn(String encryptionKeyArn) { this.encryptionKeyArn = encryptionKeyArn; }
|
||||
|
||||
public boolean isRunInContainer() { return runInContainer; }
|
||||
public void setRunInContainer(boolean runInContainer) { this.runInContainer = runInContainer; }
|
||||
|
||||
|
||||
@@ -51,6 +51,10 @@ public abstract class SparkConnectSessionOwner<R> implements SparkConnectServers
|
||||
/** Checks the session again at its next deadline, or cancels its check where it has none. */
|
||||
protected abstract void checkLater(R stored);
|
||||
|
||||
/** Sets on the session what its server's first answer gives it, before it is saved IDLE; nothing by default. */
|
||||
protected void ready(R stored) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void running(String sessionId) {
|
||||
inState(sessionId, SUBMITTED, stored -> {
|
||||
@@ -69,6 +73,7 @@ public abstract class SparkConnectSessionOwner<R> implements SparkConnectServers
|
||||
session.setStartedAt(now);
|
||||
session.setIdleSince(now);
|
||||
session.setUpdatedAt(now);
|
||||
ready(stored);
|
||||
save(stored);
|
||||
checkLater(stored);
|
||||
LOG.infov("Session {0} is ready", sessionId);
|
||||
|
||||
Reference in new issue
Block a user