Skip to content

Commit

Permalink
Include sharding info in graph view
Browse files Browse the repository at this point in the history
Extends the GraphViz output we generate with a row indicating nodes'
sharding.
  • Loading branch information
ms705 committed Jun 24, 2018
1 parent 283d4ff commit 8d58fc9
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions dataflow/src/node/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ impl Node {
MaterializationStatus::Full => "| █",
};

let sharding = match self.sharded_by {
Sharding::ByColumn(k, w) => format!("shard ⚷: {} / {}-way", k, w),
Sharding::Random(_) => format!("shard randomly"),
Sharding::None => "unsharded".to_owned(),
Sharding::ForcedNone => "desharded to avoid SS".to_owned(),
};

let addr = match self.index {
Some(ref idx) => if idx.has_local() {
format!("{} / {}", idx.as_global().index(), **idx)
Expand All @@ -62,31 +69,37 @@ impl Node {
NodeType::Dropped => s.push_str(&format!("{{ {} | dropped }}", addr)),
NodeType::Base(..) => {
s.push_str(&format!(
"{{ {{ {} / {} | {} {} }} | {} }}",
"{{ {{ {} / {} | {} {} }} | {} | {} }}",
addr,
Self::escape(self.name()),
"B",
materialized,
self.fields().join(", \\n")
self.fields().join(", \\n"),
sharding
));
}
NodeType::Ingress => s.push_str(&format!(
"{{ {{ {} {} }} | (ingress) }}",
addr, materialized
"{{ {{ {} {} }} | (ingress) | {} }}",
addr, materialized, sharding
)),
NodeType::Egress { .. } => s.push_str(&format!("{{ {} | (egress) }}", addr)),
NodeType::Sharder { .. } => s.push_str(&format!("{{ {} | (sharder) }}", addr)),
NodeType::Egress { .. } => {
s.push_str(&format!("{{ {} | (egress) | {} }}", addr, sharding))
}
NodeType::Sharder { .. } => {
s.push_str(&format!("{{ {} | (sharder) | {} }}", addr, sharding))
}
NodeType::Reader(ref r) => {
let key = match r.key() {
None => String::from("none"),
Some(k) => format!("{:?}", k),
};
s.push_str(&format!(
"{{ {{ {} / {} {} }} | (reader / ⚷: {}) }}",
"{{ {{ {} / {} {} }} | (reader / ⚷: {}) | {} }}",
addr,
Self::escape(self.name()),
materialized,
key,
sharding,
))
}
NodeType::Internal(ref i) => {
Expand All @@ -103,7 +116,7 @@ impl Node {

// Output node outputs. Second row.
s.push_str(&format!(" | {}", self.fields().join(", \\n")));
s.push_str(" }}")
s.push_str(&format!(" | {} }}", sharding))
}
};

Expand Down

0 comments on commit 8d58fc9

Please sign in to comment.