Slurm sreport 使用指南

sreport 是 Slurm 的报告工具,用于生成集群使用情况的各类统计报告。本指南涵盖了最常用的 sreport 命令和参数。

基本语法

sreport [options] <command> [command_options]

常用时间格式

  • StartTime=YYYY-MM-DD[THH:MM[:SS]]
  • EndTime=YYYY-MM-DD[THH:MM[:SS]]
  • 相对时间:
    • now
    • today
    • yesterday
    • midnight
    • noon
    • fiveminago
    • hourago
    • lastweek
    • lastmonth
    • lastquarter
    • lastyear

常用命令

1. 集群利用率报告

# 查看过去一个月的集群利用率
sreport cluster utilization start=lastmonth end=now

# 按天显示集群利用率
sreport cluster utilization -t hour start=lastweek end=now

# 查看指定时间段的利用率
sreport cluster utilization start=2024-01-01 end=2024-02-01

2. 用户使用情况统计

# 查看所有用户的资源使用情况
sreport user top start=lastmonth end=now

# 按账户组统计用户使用情况
sreport user top accounts start=lastmonth end=now

# 查看特定用户的使用情况
sreport user top user=username start=lastmonth end=now

3. 账户使用情况统计

# 查看所有账户的资源使用情况
sreport cluster AccountUtilizationByUser start=lastmonth end=now

# 查看特定账户的使用情况
sreport cluster AccountUtilizationByUser accounts=accountname start=lastmonth end=now

# 按组统计账户使用情况
sreport cluster AccountUtilizationByUser group start=lastmonth end=now

4. 作业统计报告

# 查看作业统计信息
sreport job sizes printjobcount start=lastmonth end=now

# 按账户统计作业信息
sreport job sizesbyaccount printjobcount start=lastmonth end=now

常用选项说明

  • -t, --time-format: 设置时间显示格式
    • 可选值:secper, mins, hour, day, week, month, year
  • -n, --noheader: 不显示表头
  • -P, --parsable2: 以机器可解析的格式输出(用"|"分隔)
  • --federation: 显示联邦集群信息
  • --All_Clusters: 显示所有集群的信息
  • --tres: 指定要显示的资源类型

输出格式示例

# 集群利用率报告示例输出
--------------------------------------------------------------------------------
Cluster Utilization 2024-01-01T00:00:00 - 2024-02-01T00:00:00
Usage reported in CPU Minutes
--------------------------------------------------------------------------------
  Cluster     Allocated       Down        PLND Down    Idle        Reserved    Reported  
--------- ------------- ------------- ------------- ------------- ------------- -------------
   cluster     10000000      1000000            0      2000000       500000     13500000

最佳实践

  1. 定期监控

    • 每天检查集群利用率
    • 每周生成用户使用报告
    • 每月进行账户使用统计
  2. 数据导出

    # 导出CSV格式报告
    sreport cluster utilization -P --time-format=percent start=lastmonth end=now > report.csv
    
  3. 自动化报告

    # 创建定时任务生成报告
    0 1 * * * sreport cluster utilization start=yesterday end=now > /path/to/daily_report.txt
    

故障排除

  1. 如果报告显示数据不完整:

    • 检查 accounting 数据库状态
    • 确认 slurmdbd 服务正常运行
    • 验证时间范围设置是否正确
  2. 如果命令执行较慢:

    • 缩小查询时间范围
    • 使用更具体的筛选条件
    • 避开系统繁忙时间运行报告

相关命令

  • sacct: 查看作业历史记录
  • sinfo: 查看集群节点状态
  • squeue: 查看当前作业队列
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值