-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DM-46503: Implement Mermaid for pipeline and quantum graph visualization #459
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #459 +/- ##
==========================================
- Coverage 83.20% 82.32% -0.89%
==========================================
Files 103 106 +3
Lines 12227 12561 +334
Branches 1546 1609 +63
==========================================
+ Hits 10174 10341 +167
- Misses 1642 1795 +153
- Partials 411 425 +14 ☔ View full report in Codecov by Sentry. |
d0bce24
to
8b3be62
Compare
|
||
Parameters | ||
---------- | ||
qgraph : `lsst.pipe.base.QuantumGraph` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To help with readability in the built docs, you could prefix this with a ~
:
qgraph : `~lsst.pipe.base.QuantumGraph`
close = True | ||
|
||
# Start Mermaid code block and flowchart. | ||
print("```mermaid", file=file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not part of mermaid, right? This is a markdown wrapper around mermaid, to allow mermaid to be parsed in a markdown file? This may break things for other users who are using another tool to convert mermaid into a PNG/SVG/PDF/etc, and so should probably be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, we don't really need that. Removed it!
print(f"{taskNodeName} --> {dsNode}", file=file) | ||
|
||
# End Mermaid code block. | ||
print("```", file=file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here, this is markdown syntax, not mermaid syntax, if I understand mermaid correctly?
"""Format and sort dimension names as a comma-separated list inside curly | ||
braces. | ||
|
||
For example, if dims=["detector", "visit"], returns "{detector,visit}". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returns "{detector, visit}".
if not dims: | ||
return "" | ||
sorted_dims = sorted(dims) | ||
return "{" + ", ".join(sorted_dims) + "}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you changed this to:
return "{" + ", ".join(sorted_dims) + "}"
I think it would prevent line breaks across dimensions, which would aid in readability and more closely mimic the existing DOT outputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
|
||
# If storage class is available and requested, display it. | ||
if show_storage and getattr(connection, "storageClass", None) is not None: | ||
lines.append(f"<i>storage class:</i> {html.escape(str(connection.storageClass))}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a
between storage
and class
would also help prevent line breaks here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
close = True | ||
|
||
# Begin the Mermaid code block with top-down layout. | ||
print("```mermaid", file=file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, I think this is markdown syntax, rather than something in the mermaid schema. Is that correct?
print(f"linkStyle {prereq_str} stroke-dasharray:5;", file=file) | ||
|
||
# End code block | ||
print("```", file=file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also potential markdown syntax.
xgraph, options = parse_display_args(pipeline_graph, **kwargs) | ||
|
||
# Begin the Mermaid code block. | ||
print("```mermaid", file=stream) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also potential markdown syntax.
print(f"linkStyle {','.join(prereq_indices)} stroke-dasharray:5;", file=stream) | ||
|
||
# End code block. | ||
print("```", file=stream) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also potential markdown syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! A few formatting suggestions which I hope are useful. Nicely done!
513b0aa
to
61f3361
Compare
Checklist
doc/changes