mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(emr): run the YARN timeline server and the Tez UI on a cluster's primary node in the docker runner mode (#8804)
With runner-mode docker, a cluster with Hadoop now runs the YARN
timeline server on its primary node, and one with Tez too the Tez UI
("Tez | http://master-public-dns-name:8080/tez-ui"), and
GetOnClusterAppUIPresignedURL opens both for real, on their own hosts,
as the cluster's other interfaces open (YarnTimelineService, TezUI).
The timeline server is Hadoop's own on its default port, 8188, its
store on the primary node's volume; the ResourceManager publishes its
applications to it, and, as no source gives how EMR's Tez reaches it, a
Hive step's Tez logs its DAGs to it through its REST interface
(ATSHistoryLoggingService). The Tez UI is Tez's own page, served on
8080, whose configuration (/etc/tez-ui/conf/configs.js, which the
image's page links to and lacks) names the timeline server and the
ResourceManager by the node's name, which Floci makes the link's hosts;
both answer cross-origin requests from the Tez UI's host. Both start
with the node's other daemons, the timeline server before the
ResourceManager, and the node is ready once both answer. The Tez UI runs
where the cluster's image has Tez, one with Hive or Floci's Pig, and an
image without its files serves none rather than keep the node from being
ready. Neither runs
for a release of the AWS runtime for Apache Spark, as their persistent
interfaces are not there.
EmrAppUiNightlyIntegrationTest runs them for real: after a Hive step,
the timeline server holds its Tez DAG and its application history, and
the Tez UI's page and configuration open, the timeline server answering
a request from the Tez UI's host.
This commit is contained in:
1 parent
77565a9c60
commit
3210ee0263
11 files changed
+321
-43
No files matched your search
+15
-9
@@ -373,8 +373,8 @@ not Jupyter:
|
||||
|
||||
## Application UIs
|
||||
|
||||
Floci keeps a cluster's persistent application UIs, but serves no persistent UI, Tez UI or YARN timeline server: a
|
||||
presigned URL to one of those opens a page Floci serves at `/_aws/emr/app-ui` on its own address
|
||||
Floci keeps a cluster's persistent application UIs, but serves none of them: a presigned URL to one opens a page Floci
|
||||
serves at `/_aws/emr/app-ui` on its own address
|
||||
(`base-url`, or `hostname`), with the cluster as `DescribeCluster` gives it and the interface asked for, and so does
|
||||
one to an on-cluster UI in the `immediate` mode. The link is signed with a key Floci makes as it starts and lasts an
|
||||
hour, as no source gives AWS's; one changed, past its hour or given before Floci restarted opens a `403` page, and one
|
||||
@@ -387,8 +387,13 @@ its `SparkHistoryServer` ("Spark HistoryServer | http://master-public-dns-name:1
|
||||
cluster's YARN keeps its event logs where "By default, Amazon EMR stores event logs", "the /var/log/spark/apps directory
|
||||
of HDFS" (`spark.eventLog.dir`, unless the cluster's `spark-defaults` give another, which the server then does not
|
||||
read), and gives the server's address as `spark.yarn.historyServer.address`, so an ended application's tracking URL
|
||||
leads to its page there; the server reads that folder only, whatever the cluster's `spark.history.*` settings say.
|
||||
Each opens on a host of
|
||||
leads to its page there; the server reads that folder only, whatever the cluster's `spark.history.*` settings say. On a
|
||||
cluster with Hadoop, the `YarnTimelineService`, Hadoop's YARN timeline server on its own default port, 8188, with its
|
||||
store on the primary node's volume, which the ResourceManager publishes its applications to and which, as no source
|
||||
gives how EMR's Tez reaches it, a Hive step's Tez logs its DAGs to through its REST interface; and on one with Tez too,
|
||||
where its image has Tez (a cluster with Hive, or Floci's Pig), the `TezUI` ("Tez |
|
||||
http://master-public-dns-name:8080/tez-ui"), Tez's own page, whose configuration names the
|
||||
timeline server and the ResourceManager, both of which answer its requests from its own host. Each opens on a host of
|
||||
its own, as AWS's application UIs are on hosts of their own under "emrappui-prod.us-east-1.amazonaws.com", which "are
|
||||
registered in the Public Suffix List": `http://<secret>-<port>.emrappui.<Floci's host and port>/`, the secret 26
|
||||
random letters and digits that only this link holds, so the host itself is the link's authority, as the interface
|
||||
@@ -422,9 +427,9 @@ arrives, and an interface that sends nothing for a minute has the request given
|
||||
refused, and the URL is `PresignedURLReady` at once. **GetOnClusterAppUIPresignedURL** gives one to an on-cluster UI,
|
||||
the `ResourceManager` by default, while the cluster is `RUNNING` or `WAITING`, and none for a `DryRun`. With an
|
||||
`ApplicationId`, the ResourceManager's link lands on the application's page, an application master's on its UI
|
||||
through the web proxy, the JobHistory server's on the job of that id (`job_` in place of `application_`), and the
|
||||
Spark History Server's on the application's; without one, on the cluster's applications, its running ones, its jobs,
|
||||
and its Spark applications. A link Floci opens for real is
|
||||
through the web proxy, the JobHistory server's on the job of that id (`job_` in place of `application_`), the Spark
|
||||
History Server's, the timeline server's and the Tez UI's on the application's; without one, on the cluster's
|
||||
applications, its running ones, its jobs, its Spark applications, its application history and its DAGs. A link Floci opens for real is
|
||||
`PresignedURLReady` once the primary node is: until then, as on a cluster no step has run on yet, the node starts as
|
||||
a step's would ("Used to determine if the presigned URL is ready"), and its host answers with a `503` page meanwhile.
|
||||
Any other is ready at once.
|
||||
@@ -549,8 +554,9 @@ holding the driver and its executors, or a command or a script. The cluster itse
|
||||
run on them. Beside them runs the MapReduce JobHistory server EMR's primary node runs too (a release's `mapred-site`
|
||||
classification "Restarts Hadoop MapReduce-HistoryServer"), on Hadoop's own ports, 10020 and 19888 for its web
|
||||
pages, from the jobs' history in the cluster's HDFS, and, on a cluster with Spark, a Spark History Server on 18080,
|
||||
from the Spark applications' event logs in `/var/log/spark/apps` of the cluster's HDFS (see
|
||||
[Application UIs](#application-uis)); the node is ready once both answer. A
|
||||
from the Spark applications' event logs in `/var/log/spark/apps` of the cluster's HDFS, on one with Hadoop the YARN
|
||||
timeline server on 8188, and on one with Tez the Tez UI's page on 8080 (see [Application UIs](#application-uis)); the
|
||||
node is ready once each answers. A
|
||||
Spark step or custom JAR step submits to it, with `--master yarn` unless it names another master, and in the deploy
|
||||
mode it asks for, `client` when it names none, and so does a `spark-submit` a command or script starts. In client
|
||||
mode the driver stays in the step's container and its output in the step's logs, and the executors run in YARN's
|
||||
|
||||
@@ -118,19 +118,21 @@ public interface ClusterStorage {
|
||||
* the primary node too when it {@code primaryWorks}, each offering its containers {@code memoryMb} of memory and
|
||||
* {@code vcores} virtual cores, which run its steps' Spark executors; the folder of the nodes' image holding the
|
||||
* Hadoop their daemons run from, or null for the image's own; the copies of a block its HDFS keeps; the S3
|
||||
* folder its applications' logs go in, or null; and whether its primary node runs a Spark History Server, as on a
|
||||
* cluster with Spark. A primary node that works runs a DataNode as well.
|
||||
* folder its applications' logs go in, or null; whether its primary node runs a Spark History Server, as on a
|
||||
* cluster with Spark; and whether it runs the YARN timeline server, as on a cluster with Hadoop, and the Tez UI, as
|
||||
* on one with Tez. A primary node that works runs a DataNode as well.
|
||||
*/
|
||||
record Yarn(int memoryMb, int vcores, String hadoopFolder, List<Node> nodes, int replication, String logFolder,
|
||||
boolean primaryWorks, boolean sparkHistory) {
|
||||
boolean primaryWorks, boolean sparkHistory, boolean timelineServer, boolean tezUi) {
|
||||
|
||||
Yarn(int memoryMb, int vcores) {
|
||||
this(memoryMb, vcores, null, List.of(), 1, null, true, false);
|
||||
this(memoryMb, vcores, null, List.of(), 1, null, true, false, false, false);
|
||||
}
|
||||
|
||||
/** This YARN with its daemons run from the Hadoop in {@code folder}. */
|
||||
Yarn withHadoopFolder(String folder) {
|
||||
return new Yarn(memoryMb, vcores, folder, nodes, replication, logFolder, primaryWorks, sparkHistory);
|
||||
return new Yarn(memoryMb, vcores, folder, nodes, replication, logFolder, primaryWorks, sparkHistory,
|
||||
timelineServer, tezUi);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,17 +141,25 @@ public interface ClusterStorage {
|
||||
*/
|
||||
Yarn onNodes(List<Node> workers, int copies, String folder) {
|
||||
return new Yarn(memoryMb, vcores, hadoopFolder, List.copyOf(workers), copies, folder,
|
||||
workers.stream().noneMatch(Node::core), sparkHistory);
|
||||
workers.stream().noneMatch(Node::core), sparkHistory, timelineServer, tezUi);
|
||||
}
|
||||
|
||||
/** This YARN with its primary node running a DataNode and a NodeManager, or not. */
|
||||
Yarn withPrimaryWorking(boolean works) {
|
||||
return new Yarn(memoryMb, vcores, hadoopFolder, nodes, replication, logFolder, works, sparkHistory);
|
||||
return new Yarn(memoryMb, vcores, hadoopFolder, nodes, replication, logFolder, works, sparkHistory,
|
||||
timelineServer, tezUi);
|
||||
}
|
||||
|
||||
/** This YARN with its primary node running the YARN timeline server, and the Tez UI, or not. */
|
||||
Yarn withHistories(boolean timeline, boolean tez) {
|
||||
return new Yarn(memoryMb, vcores, hadoopFolder, nodes, replication, logFolder, primaryWorks, sparkHistory,
|
||||
timeline, tez);
|
||||
}
|
||||
|
||||
/** This YARN with its primary node running a Spark History Server, or not. */
|
||||
Yarn withSparkHistory(boolean runs) {
|
||||
return new Yarn(memoryMb, vcores, hadoopFolder, nodes, replication, logFolder, primaryWorks, runs);
|
||||
return new Yarn(memoryMb, vcores, hadoopFolder, nodes, replication, logFolder, primaryWorks, runs,
|
||||
timelineServer, tezUi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,12 +39,12 @@ import java.util.regex.Pattern;
|
||||
* A cluster's application user interfaces: the persistent ones "hosted off-cluster" (Amazon EMR Management Guide, "View
|
||||
* persistent application user interfaces in Amazon EMR") and the on-cluster ones, both reached through presigned URLs.
|
||||
* In the docker runner mode, an on-cluster UI that runs on the cluster's primary node, its ResourceManager, an
|
||||
* application master through it, its MapReduce JobHistory server, the NodeManager of a primary node that works, or the
|
||||
* Spark History Server of a cluster with Spark, opens for real through {@link EmrAppUiProxy}, on a host of its own
|
||||
* under {@link #UI_HOST}, as AWS's are under "emrappui-prod.us-east-1.amazonaws.com" (Management Guide, "View Amazon
|
||||
* EMR application history"). Floci keeps a persistent application UI's record, but serves no persistent UI, Tez UI or
|
||||
* YARN timeline server: a link to one of those, and to any on-cluster UI elsewhere, opens a page of Floci's own about
|
||||
* the cluster
|
||||
* application master through it, its MapReduce JobHistory server, the NodeManager of a primary node that works, the
|
||||
* Spark History Server of a cluster with Spark, or the YARN timeline server and the Tez UI of one with Hadoop and Tez,
|
||||
* opens for real through {@link EmrAppUiProxy}, on a host of its own under {@link #UI_HOST}, as AWS's are under
|
||||
* "emrappui-prod.us-east-1.amazonaws.com" (Management Guide, "View Amazon EMR application history"). Floci keeps a
|
||||
* persistent application UI's record, but serves no persistent UI: a link to one, and to any on-cluster UI elsewhere,
|
||||
* opens a page of Floci's own about the cluster
|
||||
* ({@link EmrAppUiController}). Either link is valid for {@link #VALIDITY}: the page's is signed with a key of this
|
||||
* process, and a proxied interface's host holds a secret this process gave it.
|
||||
*/
|
||||
@@ -74,6 +74,8 @@ public class EmrAppUiService {
|
||||
static final String APPLICATION_MASTER = "ApplicationMaster";
|
||||
static final String JOB_HISTORY_SERVER = "JobHistoryServer";
|
||||
static final String SPARK_HISTORY_SERVER = "SparkHistoryServer";
|
||||
static final String YARN_TIMELINE_SERVICE = "YarnTimelineService";
|
||||
static final String TEZ_UI = "TezUI";
|
||||
// No source gives AWS's wording for these; they are Floci's.
|
||||
static final String NO_SUCH_INTERFACE = "This link opens none of the cluster's interfaces on that port.";
|
||||
static final String CLUSTER_ENDED = "Cluster %s is no longer running, and its on-cluster application UIs are"
|
||||
@@ -270,6 +272,8 @@ public class EmrAppUiService {
|
||||
case RESOURCE_MANAGER, APPLICATION_MASTER -> EmrClusterStorage.RESOURCE_MANAGER_WEB_PORT;
|
||||
case JOB_HISTORY_SERVER -> EmrServerlessSparkRunner.JOB_HISTORY_WEB_PORT;
|
||||
case SPARK_HISTORY_SERVER -> EmrServerlessSparkRunner.SPARK_HISTORY_WEB_PORT;
|
||||
case YARN_TIMELINE_SERVICE -> EmrClusterStorage.TIMELINE_WEB_PORT;
|
||||
case TEZ_UI -> EmrClusterStorage.TEZ_UI_PORT;
|
||||
default -> 0;
|
||||
};
|
||||
return interfaces.ports().contains(port) ? port : null;
|
||||
@@ -286,6 +290,9 @@ public class EmrAppUiService {
|
||||
yield matcher != null && matcher.matches() ? "/jobhistory/job/job_" + matcher.group(1) : "/jobhistory";
|
||||
}
|
||||
case SPARK_HISTORY_SERVER -> application != null ? "/history/" + application + "/" : "/";
|
||||
case YARN_TIMELINE_SERVICE -> application != null ? "/applicationhistory/app/" + application
|
||||
: "/applicationhistory";
|
||||
case TEZ_UI -> EmrClusterStorage.TEZ_UI_PATH + (application != null ? "#/app/" + application : "");
|
||||
default -> application != null ? "/cluster/app/" + application : "/cluster";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -143,6 +143,22 @@ public class EmrClusterStorage implements ClusterStorage, ContainerTeardown {
|
||||
// The MapReduce JobHistory server's information on its web port, which says it has started.
|
||||
private static final String JOB_HISTORY_INFO = "http://" + BIND + ":"
|
||||
+ EmrServerlessSparkRunner.JOB_HISTORY_WEB_PORT + "/ws/v1/history/info";
|
||||
/** The YARN timeline server's web port, Hadoop's default {@code yarn.timeline-service.webapp.address}'s. */
|
||||
static final int TIMELINE_WEB_PORT = 8188;
|
||||
/** The port the Tez UI is served on, at {@link #TEZ_UI_PATH}: "Tez | http://master-public-dns-name:8080/tez-ui". */
|
||||
static final int TEZ_UI_PORT = 8080;
|
||||
static final String TEZ_UI_PATH = "/tez-ui/";
|
||||
// Set on a primary node that runs the YARN timeline server, as on a cluster with Hadoop, and the Tez UI, as on one
|
||||
// with Tez; what each answers on its web port says it has started. The Tez UI's configuration, which its page
|
||||
// reads, names the timeline server and the ResourceManager by the node's name, whose links Floci makes the
|
||||
// browser's.
|
||||
private static final String TIMELINE_VARIABLE = "FLOCI_YARN_TIMELINE";
|
||||
private static final String TEZ_UI_VARIABLE = "FLOCI_TEZ_UI";
|
||||
private static final String TIMELINE_ABOUT = "http://" + BIND + ":" + TIMELINE_WEB_PORT + "/ws/v1/timeline";
|
||||
private static final String TEZ_UI_PAGE = "http://" + BIND + ":" + TEZ_UI_PORT + TEZ_UI_PATH;
|
||||
private static final String TEZ_UI_CONFIG = "/etc/tez-ui/conf/configs.js";
|
||||
// The Tez UI's files, which an image with Tez has, one with Hive or Floci's Pig.
|
||||
private static final String TEZ_UI_FILES = "/usr/lib/tez/tez-ui";
|
||||
// Set on a primary node that runs a Spark History Server, as on a cluster with Spark; its version on its web port
|
||||
// says it has started.
|
||||
private static final String SPARK_HISTORY_VARIABLE = "FLOCI_SPARK_HISTORY";
|
||||
@@ -217,6 +233,23 @@ public class EmrClusterStorage implements ClusterStorage, ContainerTeardown {
|
||||
+ " \"<property><name>dfs.datanode.ipc.address</name>"
|
||||
+ "<value>$FLOCI_HDFS_BIND:9867</value></property>\""
|
||||
+ " '</configuration>' > " + HDFS_CONF + "/hdfs-site.xml",
|
||||
"timeline=; [ -z \"$" + TIMELINE_VARIABLE + "\" ] || timeline=\"" + String.join("", List.of(
|
||||
property("yarn.timeline-service.enabled", "true"),
|
||||
property("yarn.timeline-service.hostname", "$FLOCI_HDFS_HOST"),
|
||||
property("yarn.timeline-service.bind-host", "$FLOCI_HDFS_BIND"),
|
||||
property("yarn.timeline-service.leveldb-timeline-store.path", "/mnt/yarn/timeline"),
|
||||
property("yarn.timeline-service.http-cross-origin.enabled", "true"),
|
||||
property("yarn.resourcemanager.webapp.cross-origin.enabled", "true"),
|
||||
// The ResourceManager publishes its applications there: Hadoop 3.4 reads the first, which
|
||||
// deprecates the second that earlier releases' Hadoop may still read.
|
||||
property("yarn.system-metrics-publisher.enabled", "true"),
|
||||
property("yarn.resourcemanager.system-metrics-publisher.enabled", "true"))) + "\"",
|
||||
"if [ -n \"$" + TEZ_UI_VARIABLE + "\" ]; then",
|
||||
" mkdir -p " + TEZ_UI_CONFIG.substring(0, TEZ_UI_CONFIG.lastIndexOf('/')) + " && printf '%s\\n' 'ENV = {'"
|
||||
+ " ' hosts: {' \" timeline: 'http://$FLOCI_HDFS_HOST:" + TIMELINE_WEB_PORT + "',\""
|
||||
+ " \" rm: 'http://$FLOCI_HDFS_HOST:" + RESOURCE_MANAGER_WEB_PORT + "',\" ' },' '};'"
|
||||
+ " > " + TEZ_UI_CONFIG + " || exit",
|
||||
"fi",
|
||||
"if [ -n \"$" + YARN_MEMORY_VARIABLE + "\" ]; then",
|
||||
" printf '%s\\n' '<configuration>'" + yarnProperties(List.of(
|
||||
"yarn.resourcemanager.hostname", "$FLOCI_HDFS_HOST",
|
||||
@@ -235,7 +268,7 @@ public class EmrClusterStorage implements ClusterStorage, ContainerTeardown {
|
||||
"yarn.nodemanager.aux-services", "mapreduce_shuffle",
|
||||
"yarn.resourcemanager.nodes.exclude-path", YARN_EXCLUDE,
|
||||
"yarn.resourcemanager.decommissioning-nodes-watcher.poll-interval-secs", "3"))
|
||||
+ " '</configuration>' > " + HDFS_CONF + "/yarn-site.xml || exit",
|
||||
+ " \"$timeline\" '</configuration>' > " + HDFS_CONF + "/yarn-site.xml || exit",
|
||||
" printf '%s\\n' '<configuration>'" + yarnProperties(List.of(
|
||||
"yarn.scheduler.capacity.root.queues", "default",
|
||||
"yarn.scheduler.capacity.root.default.capacity", "100",
|
||||
@@ -335,6 +368,14 @@ public class EmrClusterStorage implements ClusterStorage, ContainerTeardown {
|
||||
+ " \"${site[@]}\" & n=$((n + 1)); "
|
||||
+ "fi; "
|
||||
+ "if [ -n \"$" + YARN_MEMORY_VARIABLE + "\" ]; then "
|
||||
+ "if [ -n \"$" + TIMELINE_VARIABLE + "\" ]; then "
|
||||
+ "JDK_JAVA_OPTIONS=\"" + yarnOpens() + "\" yarn timelineserver & n=$((n + 1)); fi; "
|
||||
+ "tez_ui=; if [ -n \"$" + TEZ_UI_VARIABLE + "\" ]; then "
|
||||
+ "if [ -d " + TEZ_UI_FILES + " ]; then tez_ui=1; "
|
||||
+ "else echo \"Floci: no Tez UI in this image, at " + TEZ_UI_FILES + "\" >&2; fi; fi; "
|
||||
+ "if [ -n \"$tez_ui\" ]; then "
|
||||
+ "python3 -m http.server " + TEZ_UI_PORT + " --bind $FLOCI_HDFS_BIND --directory /usr/lib/tez"
|
||||
+ " > /dev/null 2>&1 & n=$((n + 1)); fi; "
|
||||
+ "JDK_JAVA_OPTIONS=\"" + yarnOpens() + "\" yarn resourcemanager & n=$((n + 1)); "
|
||||
+ "if [ -z \"$" + NODE_WORKERS_VARIABLE + "\" ]; then "
|
||||
+ "JDK_JAVA_OPTIONS=\"" + yarnOpens() + "\" yarn nodemanager & n=$((n + 1)); fi; "
|
||||
@@ -367,6 +408,12 @@ public class EmrClusterStorage implements ClusterStorage, ContainerTeardown {
|
||||
+ "if [ -n \"$" + SPARK_HISTORY_VARIABLE + "\" ]; then "
|
||||
+ untilReady("curl -sf -m 5 " + SPARK_HISTORY_VERSION + " > /dev/null")
|
||||
+ "fi; "
|
||||
+ "if [ -n \"$" + TIMELINE_VARIABLE + "\" ]; then "
|
||||
+ untilReady("curl -sf -m 5 " + TIMELINE_ABOUT + " > /dev/null")
|
||||
+ "fi; "
|
||||
+ "if [ -n \"$tez_ui\" ]; then "
|
||||
+ untilReady("curl -sf -m 5 " + TEZ_UI_PAGE + " > /dev/null")
|
||||
+ "fi; "
|
||||
+ "touch " + HDFS_READY + "; "
|
||||
// Not wait -n: an emr-6.x image's bash, 4.2, does not have it.
|
||||
+ "while [ \"$(jobs -rp | wc -l)\" = $n ]; do sleep 1; done; rm -f " + HDFS_READY
|
||||
@@ -765,6 +812,9 @@ public class EmrClusterStorage implements ClusterStorage, ContainerTeardown {
|
||||
if (yarn.sparkHistory()) {
|
||||
storage = storage.withSparkHistoryServer(host);
|
||||
}
|
||||
if (yarn.timelineServer()) {
|
||||
storage = storage.withTimelineServer(host);
|
||||
}
|
||||
return yarn.nodes().stream().anyMatch(Node::core) ? storage.withReplication(yarn.replication()) : storage;
|
||||
}
|
||||
}
|
||||
@@ -1253,6 +1303,11 @@ public class EmrClusterStorage implements ClusterStorage, ContainerTeardown {
|
||||
return properties.toString();
|
||||
}
|
||||
|
||||
// A Hadoop property, as a line of a site file.
|
||||
private static String property(String name, String value) {
|
||||
return "<property><name>" + name + "</name><value>" + value + "</value></property>";
|
||||
}
|
||||
|
||||
// A node script's wait until condition holds, polled; one of its n daemons exiting meanwhile ends the node.
|
||||
private static String untilReady(String condition) {
|
||||
return "until " + condition + "; do [ \"$(jobs -rp | wc -l)\" = $n ] || exit 1; sleep 0.2; done; ";
|
||||
@@ -1337,6 +1392,12 @@ public class EmrClusterStorage implements ClusterStorage, ContainerTeardown {
|
||||
if (yarn.sparkHistory()) {
|
||||
spec.withLoopbackPortBinding(EmrServerlessSparkRunner.SPARK_HISTORY_WEB_PORT, 0);
|
||||
}
|
||||
if (yarn.timelineServer()) {
|
||||
spec.withLoopbackPortBinding(TIMELINE_WEB_PORT, 0);
|
||||
}
|
||||
if (yarn.tezUi()) {
|
||||
spec.withLoopbackPortBinding(TEZ_UI_PORT, 0);
|
||||
}
|
||||
}
|
||||
if (yarn != null) {
|
||||
spec.withEnv(YARN_MEMORY_VARIABLE, String.valueOf(yarn.memoryMb()))
|
||||
@@ -1351,6 +1412,12 @@ public class EmrClusterStorage implements ClusterStorage, ContainerTeardown {
|
||||
if (yarn.sparkHistory()) {
|
||||
spec.withEnv(SPARK_HISTORY_VARIABLE, "1");
|
||||
}
|
||||
if (yarn.timelineServer()) {
|
||||
spec.withEnv(TIMELINE_VARIABLE, "1");
|
||||
}
|
||||
if (yarn.tezUi()) {
|
||||
spec.withEnv(TEZ_UI_VARIABLE, "1");
|
||||
}
|
||||
}
|
||||
// The metastore and the executors YARN runs reach Floci, Floci on the host by its address, Floci's own
|
||||
// certificate trusted when it serves TLS.
|
||||
|
||||
@@ -977,8 +977,9 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
|
||||
/**
|
||||
* The web interfaces Floci serves of a cluster's primary node, where it runs YARN there, in the docker runner
|
||||
* mode: its ResourceManager, its MapReduce JobHistory server, where the node works its NodeManager, and on a
|
||||
* cluster with Spark its Spark History Server; empty elsewhere.
|
||||
* mode: its ResourceManager, its MapReduce JobHistory server, where the node works its NodeManager, on a cluster
|
||||
* with Spark its Spark History Server, and on one with Hadoop its YARN timeline server, and with Tez its Tez UI;
|
||||
* empty elsewhere.
|
||||
*/
|
||||
public Optional<WebInterfaces> webInterfaces(EmrCluster cluster) {
|
||||
if (!runsOnClusters() || !runsYarn(cluster)) {
|
||||
@@ -993,6 +994,12 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
if (yarn.sparkHistory()) {
|
||||
ports.add(EmrServerlessSparkRunner.SPARK_HISTORY_WEB_PORT);
|
||||
}
|
||||
if (yarn.timelineServer()) {
|
||||
ports.add(EmrClusterStorage.TIMELINE_WEB_PORT);
|
||||
}
|
||||
if (yarn.tezUi()) {
|
||||
ports.add(EmrClusterStorage.TEZ_UI_PORT);
|
||||
}
|
||||
return Optional.of(new WebInterfaces(masterPrivateDnsName(cluster), Set.copyOf(ports)));
|
||||
}
|
||||
|
||||
@@ -2876,14 +2883,24 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
* primary node holds a DataNode and a NodeManager unless the cluster was created with core nodes that run, so one
|
||||
* created without keeps both as core nodes are added, the blocks it holds staying in reach.
|
||||
*/
|
||||
// The YARN timeline server runs on a cluster with Hadoop, and the Tez UI on one with Tez too, as their persistent
|
||||
// interfaces are there (EmrAppUiService), but for a release of the AWS runtime for Apache Spark; the Tez UI only
|
||||
// where the cluster's image has Tez, which one with Hive or Floci's Pig has (releaseImage).
|
||||
private ClusterStorage.Yarn yarnOf(EmrCluster cluster) {
|
||||
List<ClusterStorage.Node> nodes = workerNodes(cluster);
|
||||
boolean timeline = EmrSparkSteps.names(cluster.getApplications(), SNAPSHOT_MAPPER, "Hadoop")
|
||||
&& !(cluster.getReleaseLabel() != null
|
||||
&& EmrServerlessSparkRunner.sparkRuntime(cluster.getReleaseLabel()));
|
||||
boolean tezImage = EmrSparkSteps.installsHive(cluster.getReleaseLabel(), cluster.getApplications(),
|
||||
SNAPSHOT_MAPPER) || withPig(cluster);
|
||||
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))
|
||||
.withPrimaryWorking(cluster.getProvisionedCoreNodes() == 0 || coreNodes == 0)
|
||||
.withSparkHistory(EmrSparkSteps.names(cluster.getApplications(), SNAPSHOT_MAPPER, "Spark"));
|
||||
.withSparkHistory(EmrSparkSteps.names(cluster.getApplications(), SNAPSHOT_MAPPER, "Spark"))
|
||||
.withHistories(timeline, timeline && tezImage
|
||||
&& EmrSparkSteps.names(cluster.getApplications(), SNAPSHOT_MAPPER, "Tez"));
|
||||
}
|
||||
|
||||
// What a cluster asks of YARN when it is read, which may be later than now; what it asks now, if it has gone by then.
|
||||
|
||||
@@ -1358,7 +1358,9 @@ public class EmrServerlessSparkRunner implements SparkJobRunner, ContainerTeardo
|
||||
// jars, named here as Tez's own defaults are; its port ranges and addresses are placeholders EMR Serverless fills,
|
||||
// and its compression needs a native library the image lacks. An application master says where it is by
|
||||
// ${env.NM_HOST}, which is left for its own node to fill in: the settings are read on the step's side first, and
|
||||
// $NM_HOST or an env of the step's would be filled in there.
|
||||
// $NM_HOST or an env of the step's would be filled in there. Where the cluster's primary node runs the YARN
|
||||
// timeline server, the application master logs its DAGs there, through the timeline server's REST interface, which
|
||||
// the Tez UI reads.
|
||||
private static List<SparkSetting> tezOnYarnSettings(Job job, List<String> executorEnvironment,
|
||||
List<String> classPath, String... variables) {
|
||||
String root = hadoopRoot(job);
|
||||
@@ -1369,7 +1371,7 @@ public class EmrServerlessSparkRunner implements SparkJobRunner, ContainerTeardo
|
||||
List<String> containerVariables = new ArrayList<>(List.of(variables));
|
||||
containerVariables.add("TEZ_HOME=" + root + "/tez");
|
||||
String environment = containerEnvironment(executorEnvironment, containerVariables.toArray(String[]::new));
|
||||
return List.of(
|
||||
List<SparkSetting> settings = new ArrayList<>(List.of(
|
||||
new SparkSetting("yarn.resourcemanager.hostname", job.storage().resourceManager()),
|
||||
new SparkSetting("tez.local.mode", "false"),
|
||||
new SparkSetting("tez.framework.client", "org.apache.tez.client.TezYarnClient"),
|
||||
@@ -1394,7 +1396,15 @@ public class EmrServerlessSparkRunner implements SparkJobRunner, ContainerTeardo
|
||||
new SparkSetting("tez.task.launch.env", environment),
|
||||
new SparkSetting("tez.am.resource.memory.mb", "1024"),
|
||||
new SparkSetting("tez.runtime.intermediate-output.should-compress", "false"),
|
||||
new SparkSetting("tez.runtime.intermediate-input.is-compressed", "false"));
|
||||
new SparkSetting("tez.runtime.intermediate-input.is-compressed", "false")));
|
||||
String timeline = job.storage().timelineServer();
|
||||
if (timeline != null) {
|
||||
settings.add(new SparkSetting("tez.history.logging.service.class",
|
||||
"org.apache.tez.dag.history.logging.ats.ATSHistoryLoggingService"));
|
||||
settings.add(new SparkSetting("yarn.timeline-service.enabled", "true"));
|
||||
settings.add(new SparkSetting("yarn.timeline-service.hostname", timeline));
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
||||
// The folders holding Hadoop on a cluster's nodes, as a class path's entries; the LZO codec's beside them.
|
||||
|
||||
@@ -212,12 +212,13 @@ public interface SparkJobRunner {
|
||||
* {@code hdfsNetwork}, the cluster's own, which the container joins (all three null until it runs, the network
|
||||
* also on the host's own network, which steps share with it); and, on a cluster with Hive or HCatalog, the URI of
|
||||
* the Hive metastore service on that node, or null; how many copies of a block its HDFS keeps, when its core
|
||||
* nodes hold it, else 0; and the host of the Spark History Server on that node, which reads its Spark applications'
|
||||
* event logs, or null where it runs none.
|
||||
* nodes hold it, else 0; the host of the Spark History Server on that node, which reads its Spark applications'
|
||||
* event logs, or null where it runs none; and the host of the YARN timeline server on that node, which Tez logs its
|
||||
* DAGs to, or null where it runs none.
|
||||
*/
|
||||
record Storage(String home, String mnt, String hdfsHost, String hdfsAddress, String hdfsNetwork,
|
||||
String hiveMetastore, String resourceManager, String flociEndpoint, int replication,
|
||||
String metadataAddress, String sparkHistoryServer) {
|
||||
String metadataAddress, String sparkHistoryServer, String timelineServer) {
|
||||
|
||||
/**
|
||||
* The component label of an EMR cluster's HDFS container, which carries its service's labels as a driver
|
||||
@@ -230,19 +231,21 @@ public interface SparkJobRunner {
|
||||
|
||||
/** A cluster's volumes, before its HDFS runs. */
|
||||
public Storage(String home, String mnt) {
|
||||
this(home, mnt, null, null, null, null, null, null, 0, null, null);
|
||||
this(home, mnt, null, null, null, null, null, null, 0, null, null, null);
|
||||
}
|
||||
|
||||
/** This storage, its HDFS's NameNode on {@code host}, at {@code address} on {@code network}. */
|
||||
public Storage withHdfs(String host, String address, String network) {
|
||||
return new Storage(home, mnt, host, address, network, hiveMetastore, resourceManager, flociEndpoint,
|
||||
replication, metadataAddress, sparkHistoryServer);
|
||||
replication, metadataAddress, sparkHistoryServer,
|
||||
timelineServer);
|
||||
}
|
||||
|
||||
/** This storage, its Hive metastore service at {@code uri}. */
|
||||
public Storage withHiveMetastore(String uri) {
|
||||
return new Storage(home, mnt, hdfsHost, hdfsAddress, hdfsNetwork, uri, resourceManager, flociEndpoint,
|
||||
replication, metadataAddress, sparkHistoryServer);
|
||||
replication, metadataAddress, sparkHistoryServer,
|
||||
timelineServer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,13 +254,15 @@ public interface SparkJobRunner {
|
||||
*/
|
||||
public Storage withYarn(String host, String flociEndpoint) {
|
||||
return new Storage(home, mnt, hdfsHost, hdfsAddress, hdfsNetwork, hiveMetastore, host, flociEndpoint,
|
||||
replication, metadataAddress, sparkHistoryServer);
|
||||
replication, metadataAddress, sparkHistoryServer,
|
||||
timelineServer);
|
||||
}
|
||||
|
||||
/** This storage, its HDFS keeping {@code copies} copies of a block on its core nodes. */
|
||||
public Storage withReplication(int copies) {
|
||||
return new Storage(home, mnt, hdfsHost, hdfsAddress, hdfsNetwork, hiveMetastore, resourceManager,
|
||||
flociEndpoint, copies, metadataAddress, sparkHistoryServer);
|
||||
flociEndpoint, copies, metadataAddress, sparkHistoryServer,
|
||||
timelineServer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,7 +270,13 @@ public interface SparkJobRunner {
|
||||
*/
|
||||
public Storage withSparkHistoryServer(String host) {
|
||||
return new Storage(home, mnt, hdfsHost, hdfsAddress, hdfsNetwork, hiveMetastore, resourceManager,
|
||||
flociEndpoint, replication, metadataAddress, host);
|
||||
flociEndpoint, replication, metadataAddress, host, timelineServer);
|
||||
}
|
||||
|
||||
/** This storage, YARN's timeline server on {@code host}, which Tez's application masters log their DAGs to. */
|
||||
public Storage withTimelineServer(String host) {
|
||||
return new Storage(home, mnt, hdfsHost, hdfsAddress, hdfsNetwork, hiveMetastore, resourceManager,
|
||||
flociEndpoint, replication, metadataAddress, sparkHistoryServer, host);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -274,7 +285,8 @@ public interface SparkJobRunner {
|
||||
*/
|
||||
public Storage withMetadataAddress(String address) {
|
||||
return new Storage(home, mnt, hdfsHost, hdfsAddress, hdfsNetwork, hiveMetastore, resourceManager,
|
||||
flociEndpoint, replication, address, sparkHistoryServer);
|
||||
flociEndpoint, replication, address, sparkHistoryServer,
|
||||
timelineServer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ import static org.junit.jupiter.api.Assertions.fail;
|
||||
* own; after a MapReduce step, the ResourceManager's answer links to the job on the JobHistory server's own host, which
|
||||
* opens it, as the JobHistory server's link does; after a Spark step, whose event logs are in the cluster's HDFS, the
|
||||
* ResourceManager's answer links to the application on the Spark History Server's own host, which lists and opens it,
|
||||
* as the Spark History Server's link does.
|
||||
* as the Spark History Server's link does; after a Hive step, its Tez DAG is in the YARN timeline server, and the Tez
|
||||
* UI's page names the timeline server and the ResourceManager on their own hosts, which answer its page's requests.
|
||||
*
|
||||
* <p>A nightly check: the cluster's image, its HDFS and YARN, and a MapReduce job and a Spark one take minutes and
|
||||
* gigabytes.
|
||||
@@ -84,7 +85,8 @@ class EmrAppUiNightlyIntegrationTest {
|
||||
// Enabled, the check needs Docker: without a daemon it fails rather than pass having run nothing.
|
||||
assertTrue(DockerAvailability.isAvailable(), "the nightly check needs a Docker daemon");
|
||||
String clusterId = emr("RunJobFlow", "{\"Name\":\"app-uis\",\"ReleaseLabel\":\"emr-7.5.0\","
|
||||
+ "\"Applications\":[{\"Name\":\"Hadoop\"},{\"Name\":\"Spark\"}],"
|
||||
+ "\"Applications\":[{\"Name\":\"Hadoop\"},{\"Name\":\"Spark\"},{\"Name\":\"Hive\"},"
|
||||
+ "{\"Name\":\"Tez\"}],"
|
||||
+ "\"Instances\":{\"KeepJobFlowAliveWhenNoSteps\":true,\"InstanceGroups\":[{\"Name\":\"primary\","
|
||||
+ "\"InstanceRole\":\"MASTER\",\"InstanceType\":\"m5.xlarge\",\"InstanceCount\":1}]}}")
|
||||
.then().statusCode(200).extract().jsonPath().getString("JobFlowId");
|
||||
@@ -167,6 +169,43 @@ class EmrAppUiNightlyIntegrationTest {
|
||||
assertEquals(200, application.statusCode(), application.asString());
|
||||
assertTrue(application.asString().contains("Spark Pi"), application.asString());
|
||||
assertTrue(follow(sparkTracking).asString().contains("Spark Pi"));
|
||||
|
||||
String hiveStep = EmrRequests.addStep(clusterId, "hive", "command-runner.jar", "hive", "-e",
|
||||
"CREATE TABLE ui_rows AS SELECT 1 AS x");
|
||||
assertEquals("COMPLETED", awaitStep(clusterId, hiveStep).jsonPath().getString("Step.Status.State"));
|
||||
// The timeline server holds the query's Tez DAG, and its application history.
|
||||
String timelineLink = readyLink(clusterId, "YarnTimelineService", null);
|
||||
URI timeline = URI.create(timelineLink);
|
||||
assertEquals("/applicationhistory", timeline.getPath());
|
||||
Response applications = open(timelineLink);
|
||||
assertEquals(200, applications.statusCode(), applications.asString());
|
||||
// The ResourceManager published the query's application to it.
|
||||
Response published = open(timeline.getScheme() + "://" + timeline.getRawAuthority()
|
||||
+ "/ws/v1/applicationhistory/apps");
|
||||
assertTrue(published.jsonPath().getList("app.findAll { it.type == 'TEZ' }").size() > 0,
|
||||
published.asString());
|
||||
String dags = timeline.getScheme() + "://" + timeline.getRawAuthority() + "/ws/v1/timeline/TEZ_DAG_ID";
|
||||
Response dagEntities = open(dags);
|
||||
assertEquals(200, dagEntities.statusCode(), dagEntities.asString());
|
||||
assertFalse(dagEntities.jsonPath().getList("entities").isEmpty(), dagEntities.asString());
|
||||
// The Tez UI's page, whose configuration names the timeline server and the ResourceManager on their own hosts
|
||||
// under the same link, which answer a request from its page's host.
|
||||
String tezLink = readyLink(clusterId, "TezUI", null);
|
||||
URI tez = URI.create(tezLink);
|
||||
Response tezPage = open(tezLink);
|
||||
assertEquals(200, tezPage.statusCode(), tezPage.asString());
|
||||
assertTrue(tezPage.asString().contains("<title>Tez UI</title>"), tezPage.asString());
|
||||
String config = open(tez.getScheme() + "://" + tez.getRawAuthority() + "/tez-ui/config/configs.js").asString();
|
||||
// Each link has a secret of its own.
|
||||
String tezHosts = "http://" + tez.getHost().substring(0, 26) + "-%d.emrappui.localhost:" + PORT;
|
||||
assertTrue(config.contains(String.format(tezHosts, EmrClusterStorage.TIMELINE_WEB_PORT)), config);
|
||||
assertTrue(config.contains(String.format(tezHosts, EmrClusterStorage.RESOURCE_MANAGER_WEB_PORT)), config);
|
||||
String tezOrigin = tez.getScheme() + "://" + tez.getRawAuthority();
|
||||
Response crossOrigin = given().header("Host", timeline.getRawAuthority()).header("Origin", tezOrigin)
|
||||
.get("http://localhost:" + PORT + "/ws/v1/timeline/TEZ_DAG_ID");
|
||||
assertEquals(200, crossOrigin.statusCode(), crossOrigin.asString());
|
||||
String allowed = crossOrigin.getHeader("Access-Control-Allow-Origin");
|
||||
assertTrue(tezOrigin.equals(allowed) || "*".equals(allowed), String.valueOf(allowed));
|
||||
}
|
||||
|
||||
// A browser's request to the link, following the redirects it is sent, each to a link's host.
|
||||
|
||||
@@ -1369,12 +1369,63 @@ class EmrClusterStorageTest {
|
||||
+ "fi; if [ -n \"$FLOCI_SPARK_HISTORY\" ]; then ")
|
||||
&& entrypoint.get(2).contains("> /dev/null; do [ \"$(jobs -rp | wc -l)\" = $n ] || exit 1; sleep 0.2;"
|
||||
+ " done; fi; touch /tmp/floci-hdfs-ready")));
|
||||
// A cluster without Spark runs no Spark History Server.
|
||||
// A cluster without Spark runs no Spark History Server, and one without Hadoop no timeline server.
|
||||
assertNull(started.sparkHistoryServer());
|
||||
assertNull(started.timelineServer());
|
||||
verify(spec, never()).withEnv(eq("FLOCI_YARN_TIMELINE"), anyString());
|
||||
verify(spec, never()).withEnv(eq("FLOCI_SPARK_HISTORY"), anyString());
|
||||
verify(spec, never()).withLoopbackPortBinding(EmrServerlessSparkRunner.SPARK_HISTORY_WEB_PORT, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void aClusterWithHadoopAndTezHasItsPrimaryNodeRunTheTimelineServerAndTheTezUi() {
|
||||
when(lifecycle.probeContainer(hdfsName)).thenReturn(ContainerLiveness.NOT_RUNNING);
|
||||
when(lifecycle.createAndStart(any())).thenReturn(new ContainerLifecycleManager.ContainerInfo("c-7", Map.of()));
|
||||
when(lifecycle.probeContainer("c-7")).thenReturn(ContainerLiveness.RUNNING);
|
||||
when(lifecycle.resolveContainerNetworkIp("c-7", hdfsName)).thenReturn("172.18.0.8");
|
||||
ContainerExecStubs.completeEveryExec(docker, "c-7", 0L, "", "");
|
||||
|
||||
SparkJobRunner.Storage started = storage.hdfs("j-1", "123456789012", "us-east-1", HOST, IMAGE,
|
||||
"floci-network", null, () -> new ClusterStorage.Yarn(4096, 4).withHistories(true, true), NOT_STOPPED);
|
||||
|
||||
// Tez's application masters log their DAGs to it.
|
||||
assertEquals(HOST, started.timelineServer());
|
||||
verify(spec).withEnv("FLOCI_YARN_TIMELINE", "1");
|
||||
verify(spec).withEnv("FLOCI_TEZ_UI", "1");
|
||||
verify(spec).withLoopbackPortBinding(EmrClusterStorage.TIMELINE_WEB_PORT, 0);
|
||||
verify(spec).withLoopbackPortBinding(EmrClusterStorage.TEZ_UI_PORT, 0);
|
||||
verify(spec).withEntrypoint(argThat(entrypoint -> {
|
||||
String script = entrypoint.get(2);
|
||||
// The timeline server's settings in the node's yarn-site, its store on the node's volume, its REST
|
||||
// interface and the ResourceManager's open to the Tez UI's page on its own host.
|
||||
return script.contains("timeline=; [ -z \"$FLOCI_YARN_TIMELINE\" ] || timeline=\"<property><name>"
|
||||
+ "yarn.timeline-service.enabled</name><value>true</value></property>")
|
||||
&& script.contains("<property><name>yarn.timeline-service.leveldb-timeline-store.path</name>"
|
||||
+ "<value>/mnt/yarn/timeline</value></property>")
|
||||
&& script.contains("<property><name>yarn.timeline-service.http-cross-origin.enabled</name>"
|
||||
+ "<value>true</value></property>")
|
||||
&& script.contains(" \"$timeline\" '</configuration>' > /tmp/floci-hdfs-conf/yarn-site.xml")
|
||||
// The Tez UI's configuration names both by the node's name.
|
||||
&& script.contains("printf '%s\\n' 'ENV = {' ' hosts: {'"
|
||||
+ " \" timeline: 'http://$FLOCI_HDFS_HOST:8188',\""
|
||||
+ " \" rm: 'http://$FLOCI_HDFS_HOST:8088',\" ' },' '};' > /etc/tez-ui/conf/configs.js")
|
||||
// Started before the ResourceManager, which publishes its applications to the timeline server;
|
||||
// the Tez UI's files served where HDFS listens; both waited for before the node is ready.
|
||||
&& script.indexOf("yarn timelineserver & n=$((n + 1)); fi; ")
|
||||
< script.indexOf("yarn resourcemanager & n=$((n + 1)); ")
|
||||
&& script.contains("python3 -m http.server 8080 --bind $FLOCI_HDFS_BIND --directory /usr/lib/tez")
|
||||
// An image without the Tez UI's files serves none, and is ready without it.
|
||||
&& script.contains("tez_ui=; if [ -n \"$FLOCI_TEZ_UI\" ]; then if [ -d /usr/lib/tez/tez-ui ];"
|
||||
+ " then tez_ui=1; else echo")
|
||||
&& script.contains("<property><name>yarn.resourcemanager.system-metrics-publisher.enabled</name>"
|
||||
+ "<value>true</value></property>")
|
||||
&& script.indexOf("http://$(cat /tmp/floci-hdfs-bind):8188/ws/v1/timeline")
|
||||
< script.indexOf("touch /tmp/floci-hdfs-ready")
|
||||
&& script.indexOf("http://$(cat /tmp/floci-hdfs-bind):8080/tez-ui/")
|
||||
< script.indexOf("touch /tmp/floci-hdfs-ready");
|
||||
}));
|
||||
}
|
||||
|
||||
@Test
|
||||
void aClusterWithSparkHasItsPrimaryNodeRunASparkHistoryServerOnItsApplicationsEventLogs() {
|
||||
when(lifecycle.probeContainer(hdfsName)).thenReturn(ContainerLiveness.NOT_RUNNING);
|
||||
|
||||
@@ -87,6 +87,33 @@ class EmrOnClusterAppUiTest {
|
||||
assertTrue(history.url().contains("-18080.emrappui."), history.url());
|
||||
assertEquals("/history/" + application + "/", path(history));
|
||||
assertEquals("/", path(appUis.onClusterUrl(clusterId, "SparkHistoryServer", null, false)));
|
||||
// A cluster with Hadoop: its YARN timeline server's application history.
|
||||
EmrAppUiService.Presigned timeline = appUis.onClusterUrl(clusterId, "YarnTimelineService", application, false);
|
||||
assertTrue(timeline.url().contains("-8188.emrappui."), timeline.url());
|
||||
assertEquals("/applicationhistory/app/" + application, path(timeline));
|
||||
}
|
||||
|
||||
@Test
|
||||
void aClusterWithTezOpensItsTezUiOnTheApplicationAskedFor() {
|
||||
fixture.clusterStorage.webInterfaces.put(EmrClusterStorage.TEZ_UI_PORT,
|
||||
new ContainerLifecycleManager.EndpointInfo("localhost", 32802));
|
||||
fixture.clusterStorage.ownNetwork = true;
|
||||
EmrCluster cluster = cluster("tez", true);
|
||||
cluster.setReleaseLabel("emr-7.5.0");
|
||||
cluster.setApplications("[{\"Name\":\"Hadoop\"},{\"Name\":\"Hive\"},{\"Name\":\"Tez\"}]");
|
||||
String clusterId = fixture.service.runJobFlow(cluster, REGION).getId();
|
||||
|
||||
URI tez = URI.create(appUis.onClusterUrl(clusterId, "TezUI", "application_1_0001", false).url());
|
||||
|
||||
assertTrue(tez.getAuthority().contains("-8080.emrappui."), tez.toString());
|
||||
assertEquals("/tez-ui/", tez.getPath());
|
||||
assertEquals("/app/application_1_0001", tez.getFragment());
|
||||
// Its page asks the timeline server and the ResourceManager, on their own hosts under the same link.
|
||||
String secret = tez.getHost().substring(0, 26);
|
||||
EmrAppUiService.UiRoute route = appUis.route(tez.getAuthority(), "http");
|
||||
String primary = EmrService.masterPrivateDnsName(fixture.service.describeCluster(clusterId));
|
||||
assertEquals("http://" + secret + "-8188.emrappui.localhost:4566",
|
||||
route.rewrites().get("http://" + primary + ":8188"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -127,6 +154,22 @@ class EmrOnClusterAppUiTest {
|
||||
assertEquals(EmrAppUiController.INVALID, expired.refusal());
|
||||
}
|
||||
|
||||
@Test
|
||||
void aClusterWithTezButNeitherHiveNorPigHasNoTezUiAsItsImageHasNoTez() {
|
||||
fixture.clusterStorage.webInterfaces.put(EmrClusterStorage.TEZ_UI_PORT,
|
||||
new ContainerLifecycleManager.EndpointInfo("localhost", 32802));
|
||||
fixture.clusterStorage.ownNetwork = true;
|
||||
EmrCluster cluster = cluster("tez-alone", true);
|
||||
cluster.setReleaseLabel("emr-7.5.0");
|
||||
cluster.setApplications("[{\"Name\":\"Hadoop\"},{\"Name\":\"Spark\"},{\"Name\":\"Tez\"}]");
|
||||
String clusterId = fixture.service.runJobFlow(cluster, REGION).getId();
|
||||
|
||||
EmrAppUiService.Presigned tez = appUis.onClusterUrl(clusterId, "TezUI", null, false);
|
||||
|
||||
assertTrue(tez.url().startsWith("http://localhost:4566" + EmrAppUiService.PATH + "?"), tez.url());
|
||||
assertTrue(appUis.onClusterUrl(clusterId, "YarnTimelineService", null, false).url().contains("-8188."));
|
||||
}
|
||||
|
||||
@Test
|
||||
void aLinkOfAClusterThatHasEndedReachesNothing() {
|
||||
fixture.clusterStorage.webInterfaces.put(RESOURCE_MANAGER, RESOURCE_MANAGER_ON_HOST);
|
||||
|
||||
@@ -1264,6 +1264,22 @@ class EmrServerlessSparkRunnerTest {
|
||||
verify(spec, never()).withEnv(eq("FLOCI_YARN_SITE"), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
void aHiveStepsTezLogsItsDagsToTheTimelineServerOfItsClusterWhereItsPrimaryNodeRunsOne() {
|
||||
List<String> logged = EmrServerlessSparkRunner.hiveArguments(hiveJob(List.of("-e", "select 1"))
|
||||
.onStorage(ON_YARN.withTimelineServer("ip-10-0-0-1.ec2.internal")), ENDPOINT, AWS_ENVIRONMENT);
|
||||
List<String> notLogged = EmrServerlessSparkRunner.hiveArguments(
|
||||
hiveJob(List.of("-e", "select 1")).onStorage(ON_YARN), ENDPOINT, AWS_ENVIRONMENT);
|
||||
|
||||
for (String setting : List.of(
|
||||
"tez.history.logging.service.class=org.apache.tez.dag.history.logging.ats.ATSHistoryLoggingService",
|
||||
"yarn.timeline-service.enabled=true",
|
||||
"yarn.timeline-service.hostname=ip-10-0-0-1.ec2.internal")) {
|
||||
assertTrue(logged.contains(setting), setting + " in " + logged);
|
||||
assertFalse(notLogged.contains(setting), setting + " in " + notLogged);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aHiveStepOnItsClustersYarnRunsStockTezThereInPlaceOfEmrServerlesssPlugins() {
|
||||
List<String> arguments = EmrServerlessSparkRunner.hiveArguments(
|
||||
|
||||
Reference in new issue
Block a user