Package org.apache.spark.ui
Class UIUtils
Object
org.apache.spark.ui.UIUtils
Utility functions for generating XML pages with spark content.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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.ResponsebuildErrorResponse(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.MultivaluedStringMapdecodeURLParameter(jakarta.ws.rs.core.MultivaluedMap<String, String> params) Decode URLParameter if URL is encoded by YARN-WebAppProxyServlet.static StringdecodeURLParameter(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 StringformatBatchTime(long batchTime, long batchInterval, boolean showYYYYMMSS, TimeZone timezone) IfbatchIntervalis less than 1 second, formatbatchTimewith milliseconds.static StringformatDate(long timestamp) static StringformatDate(Date date) static StringformatDuration(long milliseconds) static StringformatDurationVerbose(long ms) Generate a verbose human-readable string representing a duration such as "5 second 35 ms"static StringformatImportJavaScript(jakarta.servlet.http.HttpServletRequest request, String sourceFile, scala.collection.immutable.Seq<String> methods) static StringformatNumber(double records) Generate a human-readable string representing a number (e.g.static intstatic 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.LogStringContextLogStringContext(scala.StringContext sc) static scala.xml.NodeSeqmakeDescription(String desc, String basePathUri, boolean plainText) Returns HTML rendering of a job or stage description.static StringReturn 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.Loggerstatic voidorg$apache$spark$internal$Logging$$log__$eq(org.slf4j.Logger x$1) static StringprependBaseUri(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 Stringstatic Stringstatic Stringstatic scala.collection.immutable.Seq<scala.xml.Node>static StringuiRoot(jakarta.servlet.http.HttpServletRequest request) static scala.collection.immutable.Seq<scala.xml.Node>vizHeaderNodes(jakarta.servlet.http.HttpServletRequest request) 
- 
Constructor Details- 
UIUtilspublic UIUtils()
 
- 
- 
Method Details- 
TABLE_CLASS_NOT_STRIPED
- 
TABLE_CLASS_STRIPED
- 
TABLE_CLASS_STRIPED_SORTABLE
- 
formatDate
- 
formatDate
- 
formatDuration
- 
formatDurationVerboseGenerate a verbose human-readable string representing a duration such as "5 second 35 ms"
- 
formatBatchTimepublic static String formatBatchTime(long batchTime, long batchInterval, boolean showYYYYMMSS, TimeZone timezone) IfbatchIntervalis less than 1 second, formatbatchTimewith milliseconds. Otherwise, formatbatchTimewithout milliseconds.- Parameters:
- batchTime- the batch time to be formatted
- batchInterval- the batch interval
- showYYYYMMSS- if showing the- yyyy/MM/ddpart. If it's false, the return value will be only- HH:mm:ssor- HH:mm:ss.SSSdepending on- batchInterval
- timezone- only for test
- Returns:
- (undocumented)
 
- 
formatNumberGenerate a human-readable string representing a number (e.g. 100 K)
- 
uiRoot
- 
prependBaseUri
- 
commonHeaderNodespublic static scala.collection.immutable.Seq<scala.xml.Node> commonHeaderNodes(jakarta.servlet.http.HttpServletRequest request) 
- 
vizHeaderNodespublic static scala.collection.immutable.Seq<scala.xml.Node> vizHeaderNodes(jakarta.servlet.http.HttpServletRequest request) 
- 
dataTablesHeaderNodespublic static scala.collection.immutable.Seq<scala.xml.Node> dataTablesHeaderNodes(jakarta.servlet.http.HttpServletRequest request) 
- 
headerSparkPagepublic 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
- 
basicSparkPagepublic 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.
- 
listingTablepublic 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
- 
showDagVizForStagepublic 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.
- 
showDagVizForJobpublic 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
- 
makeDescriptionReturns 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 onclickwill 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.
 
- 
decodeURLParameterDecode 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)
 
- 
decodeURLParameterpublic 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)
 
- 
getTimeZoneOffsetpublic static int getTimeZoneOffset()
- 
makeHrefReturn 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)
 
- 
buildErrorResponsepublic static jakarta.ws.rs.core.Response buildErrorResponse(jakarta.ws.rs.core.Response.Status status, String msg) 
- 
durationDataPaddingpublic 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)
 
- 
detailsUINodepublic static scala.collection.immutable.Seq<scala.xml.Node> detailsUINode(boolean isMultiline, String message) 
- 
errorSummaryThis 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__$eqpublic static void org$apache$spark$internal$Logging$$log__$eq(org.slf4j.Logger x$1) 
- 
LogStringContextpublic static org.apache.spark.internal.Logging.LogStringContext LogStringContext(scala.StringContext sc) 
 
-