Package org.apache.spark.ui
Class UIUtils
Object
org.apache.spark.ui.UIUtils
Utility functions for generating XML pages with spark content.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic scala.collection.Seq<scala.xml.Node>
basicSparkPage
(javax.servlet.http.HttpServletRequest request, scala.Function0<scala.collection.Seq<scala.xml.Node>> content, String title, boolean useDataTables) Returns a page with the spark css/js and a simple format.static javax.ws.rs.core.Response
buildErrorResponse
(javax.ws.rs.core.Response.Status status, String msg) static scala.collection.Seq<scala.xml.Node>
commonHeaderNodes
(javax.servlet.http.HttpServletRequest request) static scala.collection.Seq<scala.xml.Node>
dataTablesHeaderNodes
(javax.servlet.http.HttpServletRequest request) static String
decodeURLParameter
(String urlParam) Decode URLParameter if URL is encoded by YARN-WebAppProxyServlet.static org.glassfish.jersey.internal.util.collection.MultivaluedStringMap
decodeURLParameter
(javax.ws.rs.core.MultivaluedMap<String, String> params) Decode URLParameter if URL is encoded by YARN-WebAppProxyServlet.static scala.collection.Seq<scala.xml.Node>
detailsUINode
(boolean isMultiline, String message) durationDataPadding
(scala.Tuple2<Object, Map<String, Long>>[] values) There may be different duration labels in each batch.static scala.collection.Seq<scala.xml.Node>
errorMessageCell
(String errorMessage) static String
formatBatchTime
(long batchTime, long batchInterval, boolean showYYYYMMSS, TimeZone timezone) IfbatchInterval
is less than 1 second, formatbatchTime
with milliseconds.static String
formatDate
(long timestamp) static String
formatDate
(Date date) static String
formatDuration
(long milliseconds) static String
formatDurationVerbose
(long ms) Generate a verbose human-readable string representing a duration such as "5 second 35 ms"static String
formatNumber
(double records) Generate a human-readable string representing a number (e.g. 100 K)static int
static scala.collection.Seq<scala.xml.Node>
headerSparkPage
(javax.servlet.http.HttpServletRequest request, String title, scala.Function0<scala.collection.Seq<scala.xml.Node>> content, org.apache.spark.ui.SparkUITab activeTab, scala.Option<String> helpText, boolean showVisualization, boolean useDataTables) Returns a spark page with correctly formatted headersstatic <T> scala.collection.Seq<scala.xml.Node>
listingTable
(scala.collection.Seq<String> headers, scala.Function1<T, scala.collection.Seq<scala.xml.Node>> generateDataRow, scala.collection.Iterable<T> data, boolean fixedWidth, scala.Option<String> id, scala.collection.Seq<String> headerClasses, boolean stripeRowsWithCss, boolean sortable, scala.collection.Seq<scala.Option<String>> tooltipHeaders) Returns an HTML table constructed by generating a row for each object in a sequence.static scala.xml.NodeSeq
makeDescription
(String desc, String basePathUri, boolean plainText) Returns HTML rendering of a job or stage description.static String
Return the correct Href after checking if master is running in the reverse proxy mode or not.static scala.collection.Seq<scala.xml.Node>
makeProgressBar
(int started, int completed, int failed, int skipped, scala.collection.immutable.Map<String, Object> reasonToNumKilled, int total) static org.slf4j.Logger
static void
org$apache$spark$internal$Logging$$log__$eq
(org.slf4j.Logger x$1) static String
prependBaseUri
(javax.servlet.http.HttpServletRequest request, String basePath, String resource) static scala.collection.Seq<scala.xml.Node>
showDagVizForJob
(int jobId, scala.collection.Seq<org.apache.spark.ui.scope.RDDOperationGraph> graphs) Return a "DAG visualization" DOM element that expands into a visualization for a job.static scala.collection.Seq<scala.xml.Node>
showDagVizForStage
(int stageId, scala.Option<org.apache.spark.ui.scope.RDDOperationGraph> graph) Return a "DAG visualization" DOM element that expands into a visualization for a stage.static String
static String
static String
static scala.collection.Seq<scala.xml.Node>
static String
uiRoot
(javax.servlet.http.HttpServletRequest request) static scala.collection.Seq<scala.xml.Node>
vizHeaderNodes
(javax.servlet.http.HttpServletRequest request)
-
Constructor Details
-
UIUtils
public UIUtils()
-
-
Method Details
-
TABLE_CLASS_NOT_STRIPED
-
TABLE_CLASS_STRIPED
-
TABLE_CLASS_STRIPED_SORTABLE
-
formatDate
-
formatDate
-
formatDuration
-
formatDurationVerbose
Generate a verbose human-readable string representing a duration such as "5 second 35 ms" -
formatBatchTime
public static String formatBatchTime(long batchTime, long batchInterval, boolean showYYYYMMSS, TimeZone timezone) IfbatchInterval
is less than 1 second, formatbatchTime
with milliseconds. Otherwise, formatbatchTime
without milliseconds.- Parameters:
batchTime
- the batch time to be formattedbatchInterval
- the batch intervalshowYYYYMMSS
- if showing theyyyy/MM/dd
part. If it's false, the return value will be onlyHH:mm:ss
orHH:mm:ss.SSS
depending onbatchInterval
timezone
- only for test- Returns:
- (undocumented)
-
formatNumber
Generate a human-readable string representing a number (e.g. 100 K) -
uiRoot
-
prependBaseUri
-
commonHeaderNodes
public static scala.collection.Seq<scala.xml.Node> commonHeaderNodes(javax.servlet.http.HttpServletRequest request) -
vizHeaderNodes
public static scala.collection.Seq<scala.xml.Node> vizHeaderNodes(javax.servlet.http.HttpServletRequest request) -
dataTablesHeaderNodes
public static scala.collection.Seq<scala.xml.Node> dataTablesHeaderNodes(javax.servlet.http.HttpServletRequest request) -
headerSparkPage
public static scala.collection.Seq<scala.xml.Node> headerSparkPage(javax.servlet.http.HttpServletRequest request, String title, scala.Function0<scala.collection.Seq<scala.xml.Node>> content, org.apache.spark.ui.SparkUITab activeTab, scala.Option<String> helpText, boolean showVisualization, boolean useDataTables) Returns a spark page with correctly formatted headers -
basicSparkPage
public static scala.collection.Seq<scala.xml.Node> basicSparkPage(javax.servlet.http.HttpServletRequest request, scala.Function0<scala.collection.Seq<scala.xml.Node>> content, String title, boolean useDataTables) Returns a page with the spark css/js and a simple format. Used for scheduler UI. -
listingTable
public static <T> scala.collection.Seq<scala.xml.Node> listingTable(scala.collection.Seq<String> headers, scala.Function1<T, scala.collection.Seq<scala.xml.Node>> generateDataRow, scala.collection.Iterable<T> data, boolean fixedWidth, scala.Option<String> id, scala.collection.Seq<String> headerClasses, boolean stripeRowsWithCss, boolean sortable, scala.collection.Seq<scala.Option<String>> tooltipHeaders) Returns an HTML table constructed by generating a row for each object in a sequence. -
makeProgressBar
-
showDagVizForStage
public static scala.collection.Seq<scala.xml.Node> showDagVizForStage(int stageId, scala.Option<org.apache.spark.ui.scope.RDDOperationGraph> graph) Return a "DAG visualization" DOM element that expands into a visualization for a stage. -
showDagVizForJob
public static scala.collection.Seq<scala.xml.Node> showDagVizForJob(int jobId, scala.collection.Seq<org.apache.spark.ui.scope.RDDOperationGraph> graphs) Return a "DAG visualization" DOM element that expands into a visualization for a job. -
tooltip
-
makeDescription
Returns HTML rendering of a job or stage description. It will try to parse the string as HTML and make sure that it only contains anchors with root-relative links. Otherwise, the whole string will rendered as a simple escaped text.Note: In terms of security, only anchor tags with root relative links are supported. So any attempts to embed links outside Spark UI, other tags like <script>, or inline scripts like
onclick
will cause in the whole description to be treated as plain text.- Parameters:
desc
- the original job or stage description string, which may contain html tags.basePathUri
- with which to prepend the relative links; this is used when plainText is false.plainText
- whether to keep only plain text (i.e. remove html tags) from the original description string.- Returns:
- the HTML rendering of the job or stage description, which will be a Text when plainText is true, and an Elem otherwise.
-
decodeURLParameter
Decode URLParameter if URL is encoded by YARN-WebAppProxyServlet. Due to YARN-2844: WebAppProxyServlet cannot handle urls which contain encoded characters Therefore we need to decode it until we get the real URLParameter.- Parameters:
urlParam
- (undocumented)- Returns:
- (undocumented)
-
decodeURLParameter
public static org.glassfish.jersey.internal.util.collection.MultivaluedStringMap decodeURLParameter(javax.ws.rs.core.MultivaluedMap<String, String> params) Decode URLParameter if URL is encoded by YARN-WebAppProxyServlet.- Parameters:
params
- (undocumented)- Returns:
- (undocumented)
-
getTimeZoneOffset
public static int getTimeZoneOffset() -
makeHref
Return the correct Href after checking if master is running in the reverse proxy mode or not.- Parameters:
proxy
- (undocumented)id
- (undocumented)origHref
- (undocumented)- Returns:
- (undocumented)
-
buildErrorResponse
public static javax.ws.rs.core.Response buildErrorResponse(javax.ws.rs.core.Response.Status status, String msg) -
durationDataPadding
public static scala.Tuple2<Object,scala.collection.immutable.Map<String, durationDataPaddingObject>>[] (scala.Tuple2<Object, Map<String, Long>>[] values) There may be different duration labels in each batch. So we need to mark those missing duration label as '0d' to avoid UI rending error.- Parameters:
values
- (undocumented)- Returns:
- (undocumented)
-
detailsUINode
public static scala.collection.Seq<scala.xml.Node> detailsUINode(boolean isMultiline, String message) -
errorMessageCell
-
org$apache$spark$internal$Logging$$log_
public static org.slf4j.Logger org$apache$spark$internal$Logging$$log_() -
org$apache$spark$internal$Logging$$log__$eq
public static void org$apache$spark$internal$Logging$$log__$eq(org.slf4j.Logger x$1)
-