summaryrefslogtreecommitdiffstats
path: root/doc/scripts
diff options
context:
space:
mode:
authorJianshen Liu <jliu120@ucsc.edu>2020-11-18 05:44:30 +0100
committerJianshen Liu <jliu120@ucsc.edu>2020-11-19 05:26:54 +0100
commit909bfa34e6fea274759fb74c5f0719b95ccb9dfd (patch)
treea1395cde68673d0b9a9c37b7bdc249ce8fb7e437 /doc/scripts
parentMerge pull request #38102 from tchaikov/wip-mgr-boost-cleanup (diff)
downloadceph-909bfa34e6fea274759fb74c5f0719b95ccb9dfd.tar.xz
ceph-909bfa34e6fea274759fb74c5f0719b95ccb9dfd.zip
doc: increase visibility of the peering state diagram
Signed-off-by: Jianshen Liu <jliu120@ucsc.edu>
Diffstat (limited to 'doc/scripts')
-rwxr-xr-xdoc/scripts/gen_state_diagram.py32
1 files changed, 29 insertions, 3 deletions
diff --git a/doc/scripts/gen_state_diagram.py b/doc/scripts/gen_state_diagram.py
index cb968d49d4a..868eaa287d3 100755
--- a/doc/scripts/gen_state_diagram.py
+++ b/doc/scripts/gen_state_diagram.py
@@ -73,6 +73,17 @@ class StateMachineRenderer(object):
self.subgraphnum = 0
self.clusterlabel = {}
+ self.color_idx = 0
+ self.color_palette = [
+ "#000000", # black
+ "#1e90ff", # dodgerblue
+ "#ff0000", # red
+ "#0000ff", # blue
+ "#ffa500", # orange
+ "#40e0d0", # turquoise
+ "#c71585", # mediumvioletred
+ ]
+
def __str__(self):
return "-------------------\n\nstates: %s\n\n machines: %s\n\n edges: %s\n\n context %s\n\n state_contents %s\n\n--------------------" % (
self.states,
@@ -82,6 +93,13 @@ class StateMachineRenderer(object):
self.state_contents
)
+ def __next_color(self):
+ color = self.color_palette[self.color_idx]
+ self.color_idx += 1
+ if self.color_idx == len(self.color_palette):
+ self.color_idx = 0
+ return color
+
def read_input(self, input_lines):
previous_line = None
for line in input_lines:
@@ -174,7 +192,12 @@ class StateMachineRenderer(object):
yield "subgraph cluster%s {" % (str(self.subgraphnum),)
self.subgraphnum += 1
yield """\tlabel = "%s";""" % (state,)
- yield """\tcolor = "blue";"""
+ yield """\tcolor = "black";"""
+
+ if state in self.machines.values():
+ yield """\tstyle = "filled";"""
+ yield """\tfillcolor = "lightgrey";"""
+
for j in self.state_contents[state]:
for i in self.emit_state(j):
yield "\t"+i
@@ -183,7 +206,7 @@ class StateMachineRenderer(object):
found = False
for (k, v) in self.machines.items():
if v == state:
- yield state+"[shape=Mdiamond];"
+ yield state+"[shape=Mdiamond style=filled fillcolor=lightgrey];"
found = True
break
if not found:
@@ -197,7 +220,10 @@ class StateMachineRenderer(object):
retval += "]"
return retval
for (fro, to) in self.edges[event]:
- appendix = ['label="%s"' % (event,)]
+ color = self.__next_color()
+ appendix = ['label="%s"' % (event,),
+ 'color="%s"' % (color,),
+ 'fontcolor="%s"' % (color,)]
if fro in self.machines.keys():
appendix.append("ltail=%s" % (self.clusterlabel[fro],))
while fro in self.machines.keys():