-
Notifications
You must be signed in to change notification settings - Fork 47
Add visualization tool for topology cli #369
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
base: master
Are you sure you want to change the base?
Changes from all commits
d79d1dd
3f877fa
a035cd2
0e9ae1a
11484eb
8d018cb
7736b3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -590,4 +590,21 @@ def run(self): | |
| else: | ||
| print(content, end='') | ||
| log.info("Printed slurm topology") | ||
|
|
||
| return content | ||
|
|
||
|
|
||
|
|
||
| def visualize(self, topology_str: str, max_block_size: int = 1) -> str: | ||
| """ | ||
| Visualizes a block or tree topology string as ASCII art. | ||
|
|
||
| Args: | ||
| topology_str (str): The topology string (output from write_block_topology or write_tree_topology). | ||
| max_block_size (int, optional): Maximum block size for grid visualization. Defaults to 1. | ||
| Returns: | ||
| str: ASCII visualization of the topology. | ||
| """ | ||
| if self.topo_type == TopologyType.BLOCK: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you have extremely big if else blocks-- its always best to condense them into functions.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would also be nice if visualize_topology* functions actually get moved to util since its not really part of core topology logic. You also dont really need any data from the topology class. Just the string and the block size. Thats an optional suggestion though. |
||
| return slutil.visualize_block(topology_str, self.block_size, max_block_size) | ||
| else: | ||
| return slutil.visualize_tree(topology_str) | ||
Uh oh!
There was an error while loading. Please reload this page.