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.immutable.Seq<scala.xml.Node>
basicSparkPage
(jakarta.servlet.http.HttpServletRequest request, scala.Function0<scala.collection.immutable.Seq<scala.xml.Node>> content, String title, boolean useDataTables) Returns a page with the spark css/js and a simple format.static jakarta.ws.rs.core.Response
buildErrorResponse
(jakarta.ws.rs.core.Response.Status status, String msg) static scala.collection.immutable.Seq<scala.xml.Node>
commonHeaderNodes
(jakarta.servlet.http.HttpServletRequest request) static scala.collection.immutable.Seq<scala.xml.Node>
dataTablesHeaderNodes
(jakarta.servlet.http.HttpServletRequest request) static org.glassfish.jersey.internal.util.collection.MultivaluedStringMap
decodeURLParameter
(jakarta.ws.rs.core.MultivaluedMap<String, String> params) Decode URLParameter if URL is encoded by YARN-WebAppProxyServlet.static String
decodeURLParameter
(String urlParam) Decode URLParameter if URL is encoded by YARN-WebAppProxyServlet.static scala.collection.immutable.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.immutable.Seq<scala.xml.Node>
errorMessageCell
(String errorMessage) errorSummary
(String errorMessage) This function works exactly the same as utils.errorSummary(javascript), it shall bestatic 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
formatImportJavaScript
(jakarta.servlet.http.HttpServletRequest request, String sourceFile, scala.collection.immutable.Seq<String> methods) static String
formatNumber
(double records) Generate a human-readable string representing a number (e.g.static int
static scala.collection.immutable.Seq<scala.xml.Node>
headerSparkPage
(jakarta.servlet.http.HttpServletRequest request, String title, scala.Function0<scala.collection.immutable.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.immutable.Seq<scala.xml.Node>
listingTable
(scala.collection.immutable.Seq<String> headers, scala.Function1<T, scala.collection.immutable.Seq<scala.xml.Node>> generateDataRow, scala.collection.Iterable<T> data, boolean fixedWidth, scala.Option<String> id, scala.collection.immutable.Seq<String> headerClasses, boolean stripeRowsWithCss, boolean sortable, scala.collection.immutable.Seq<scala.Option<String>> tooltipHeaders) Returns an HTML table constructed by generating a row for each object in a sequence.static org.apache.spark.internal.Logging.LogStringContext
LogStringContext
(scala.StringContext sc) 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.immutable.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
(jakarta.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.immutable.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.immutable.Seq<scala.xml.Node>
static String
uiRoot
(jakarta.servlet.http.HttpServletRequest request) static scala.collection.immutable.Seq<scala.xml.Node>
vizHeaderNodes
(jakarta.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.immutable.Seq<scala.xml.Node> commonHeaderNodes(jakarta.servlet.http.HttpServletRequest request) -
vizHeaderNodes
public static scala.collection.immutable.Seq<scala.xml.Node> vizHeaderNodes(jakarta.servlet.http.HttpServletRequest request) -
dataTablesHeaderNodes
public static scala.collection.immutable.Seq<scala.xml.Node> dataTablesHeaderNodes(jakarta.servlet.http.HttpServletRequest request) -
headerSparkPage
public static scala.collection.immutable.Seq<scala.xml.Node> headerSparkPage(jakarta.servlet.http.HttpServletRequest request, String title, scala.Function0<scala.collection.immutable.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.immutable.Seq<scala.xml.Node> basicSparkPage(jakarta.servlet.http.HttpServletRequest request, scala.Function0<scala.collection.immutable.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.immutable.Seq<scala.xml.Node> listingTable(scala.collection.immutable.Seq<String> headers, scala.Function1<T, scala.collection.immutable.Seq<scala.xml.Node>> generateDataRow, scala.collection.Iterable<T> data, boolean fixedWidth, scala.Option<String> id, scala.collection.immutable.Seq<String> headerClasses, boolean stripeRowsWithCss, boolean sortable, scala.collection.immutable.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.immutable.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(jakarta.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 jakarta.ws.rs.core.Response buildErrorResponse(jakarta.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.immutable.Seq<scala.xml.Node> detailsUINode(boolean isMultiline, String message) -
errorSummary
This function works exactly the same as utils.errorSummary(javascript), it shall be- Parameters:
errorMessage
- (undocumented)- Returns:
- (undocumented) remained the same whichever changed
-
errorMessageCell
-
formatImportJavaScript
-
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) -
LogStringContext
public static org.apache.spark.internal.Logging.LogStringContext LogStringContext(scala.StringContext sc)
-