Skip to content

Commit

Permalink
Escape "label" to avoid DAG being broken by some special character
Browse files Browse the repository at this point in the history
  • Loading branch information
zsxwing committed Feb 22, 2016
1 parent 00461bb commit bf49fad
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ package org.apache.spark.ui.scope
import scala.collection.mutable
import scala.collection.mutable.{ListBuffer, StringBuilder}

import org.apache.commons.lang.StringEscapeUtils

import org.apache.spark.Logging
import org.apache.spark.scheduler.StageInfo
import org.apache.spark.storage.StorageLevel
import org.apache.spark.util.CallSite

/**
* A representation of a generic cluster graph used for storing information on RDD operations.
Expand Down Expand Up @@ -183,7 +184,7 @@ private[ui] object RDDOperationGraph extends Logging {
/** Return the dot representation of a node in an RDDOperationGraph. */
private def makeDotNode(node: RDDOperationNode): String = {
val label = s"${node.name} [${node.id}]\n${node.callsite}"
s"""${node.id} [label="$label"]"""
s"""${node.id} [label="${StringEscapeUtils.escapeJava(label)}"]"""
}

/** Update the dot representation of the RDDOperationGraph in cluster to subgraph. */
Expand All @@ -192,7 +193,7 @@ private[ui] object RDDOperationGraph extends Logging {
cluster: RDDOperationCluster,
indent: String): Unit = {
subgraph.append(indent).append(s"subgraph cluster${cluster.id} {\n")
subgraph.append(indent).append(s""" label="${cluster.name}";\n""")
.append(indent).append(s""" label="${StringEscapeUtils.escapeJava(cluster.name)}";\n""")
cluster.childNodes.foreach { node =>
subgraph.append(indent).append(s" ${makeDotNode(node)};\n")
}
Expand Down

0 comments on commit bf49fad

Please sign in to comment.