Skip to content

Conversation

@azreenz
Copy link
Collaborator

@azreenz azreenz commented Sep 15, 2025

Add azslurm show_topology command to visualize block topology configuration as table or json

usage: azslurm show_topology [-h] [--config CONFIG] [--output OUTPUT] [--format {table,json}]

options:
  -h, --help            show this help message and exit
  --config CONFIG, -c CONFIG
  --output OUTPUT       Output file for the topology (default: /etc/slurm/topology.conf)
  --format {table,json}

To view block topology configuration in table format:

azslurm show_topology --format table
Block Name |   Size | Nodes
-----------+----------+---------------------------------------------------
block3     |      8 | ccw-1-3-gpu-31, ccw-1-3-gpu-52, ccw-1-3-gpu-297...
block4     |      9 | ccw-1-3-gpu-5, ccw-1-3-gpu-17, ccw-1-3-gpu-254,...
block2     |     16 | ccw-1-3-gpu-464, ccw-1-3-gpu-7, ccw-1-3-gpu-454...
block1     |     18 | ccw-1-3-gpu-21, ccw-1-3-gpu-407, ccw-1-3-gpu-33...

Total blocks: 4
Total nodes: 51

To view block topology configuration in json format:

azslurm show_topology --format json
[
{
  "blockname": "block3",
  "size": 8,
  "nodelist": [
    "ccw-1-3-gpu-31",
    "ccw-1-3-gpu-52",
    "ccw-1-3-gpu-297",
    "ccw-1-3-gpu-319",
    "ccw-1-3-gpu-349",
    "ccw-1-3-gpu-62",
    "ccw-1-3-gpu-394",
    "ccw-1-3-gpu-122"
  ]
},
{
  "blockname": "block4",
  "size": 9,
  "nodelist": [
    "ccw-1-3-gpu-5",
    "ccw-1-3-gpu-17",
    "ccw-1-3-gpu-254",
    "ccw-1-3-gpu-284",
    "ccw-1-3-gpu-249",
    "ccw-1-3-gpu-37",
    "ccw-1-3-gpu-229",
    "ccw-1-3-gpu-109",
    "ccw-1-3-gpu-294"
  ]
},
{
  "blockname": "block2",
  "size": 16,
  "nodelist": [
    "ccw-1-3-gpu-464",
    "ccw-1-3-gpu-7",
    "ccw-1-3-gpu-454",
    "ccw-1-3-gpu-344",
    "ccw-1-3-gpu-91",
    "ccw-1-3-gpu-217",
    "ccw-1-3-gpu-324",
    "ccw-1-3-gpu-43",
    "ccw-1-3-gpu-188",
    "ccw-1-3-gpu-97",
    "ccw-1-3-gpu-434",
    "ccw-1-3-gpu-172",
    "ccw-1-3-gpu-153",
    "ccw-1-3-gpu-277",
    "ccw-1-3-gpu-147",
    "ccw-1-3-gpu-354"
  ]
},
{
  "blockname": "block1",
  "size": 18,
  "nodelist": [
    "ccw-1-3-gpu-21",
    "ccw-1-3-gpu-407",
    "ccw-1-3-gpu-333",
    "ccw-1-3-gpu-60",
    "ccw-1-3-gpu-387",
    "ccw-1-3-gpu-145",
    "ccw-1-3-gpu-190",
    "ccw-1-3-gpu-205",
    "ccw-1-3-gpu-115",
    "ccw-1-3-gpu-236",
    "ccw-1-3-gpu-164",
    "ccw-1-3-gpu-180",
    "ccw-1-3-gpu-195",
    "ccw-1-3-gpu-438",
    "ccw-1-3-gpu-305",
    "ccw-1-3-gpu-255",
    "ccw-1-3-gpu-14",
    "ccw-1-3-gpu-400"
  ]
}
]

@azreenz azreenz marked this pull request as ready for review September 15, 2025 17:01
@azreenz azreenz requested a review from Copilot September 19, 2025 17:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new azslurm show_topology command to visualize block topology configurations in either table or JSON format. The command allows users to view the current block topology configuration parsed from a topology file.

  • Adds show_topology CLI command with table and JSON output formats
  • Moves the output_block_nodelist function from topology.py to util.py for reuse
  • Updates documentation with usage examples and command description

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
azure-slurm/slurmcc/util.py Adds output_block_nodelist function and required imports for parsing topology files
azure-slurm/slurmcc/topology.py Removes output_block_nodelist function (moved to util.py)
azure-slurm/slurmcc/cli.py Adds show_topology_parser and show_topology methods to implement the new CLI command
README.md Updates documentation with show_topology command usage and examples

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@azreenz azreenz force-pushed the azreenzaman/show-topology branch from f69c7b8 to 0aa36f0 Compare September 19, 2025 18:04
@azreenz azreenz force-pushed the azreenzaman/show-topology branch from 0aa36f0 to 83d4e56 Compare September 26, 2025 17:44
@azreenz azreenz added the Do-not-merge Do not merge yet label Sep 26, 2025
@azreenz
Copy link
Collaborator Author

azreenz commented Sep 26, 2025

Moving output_block_nodelist to util.py may affect scale_m1 script since it is importing that function from topology.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Do-not-merge Do not merge yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants