Skip to content

Add --rest flag to CLI commands for Slurm REST API routing #76

@gustcol

Description

@gustcol

Summary

Add a --rest flag (or --backend=rest) to GCM CLI monitoring commands that routes Slurm queries through the REST API (SlurmRestClient) instead of the default CLI-based SlurmCliClient.

Motivation

The SlurmRestClient (PR #62) implements the same SlurmClient Protocol as SlurmCliClient, making it a drop-in replacement. However, there's currently no CLI-level switch to choose between backends. A --rest flag would allow operators to use the REST API without code changes, which is especially useful for:

  • Monitoring hosts that don't have Slurm CLI tools installed
  • Environments where slurmrestd is the preferred access method
  • Reducing subprocess overhead in high-frequency collection loops

Proposed Interface

# Use REST API instead of CLI
gcm squeue --rest --rest-url=http://slurmctl:6820 --rest-token=<jwt> --sink=stdout --once

# Or via config file
gcm squeue --backend=rest --sink=stdout --once

Additional context

Suggested by @luccabb in PR #62 review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions