Agent Skillspytorch/pytorch › ci-metrics

ci-metrics

GitHub

查询PyTorch CI、GitHub Actions及Grafana基础设施指标,用于分析CI耗时、作业失败、队列时间、工作流趋势及Runner健康状态。

.claude/skills/ci-metrics/SKILL.md pytorch/pytorch

触发场景

询问CI持续时间或作业失败情况 查询队列时间或工作流趋势 检查Runner健康状态或仪表盘数据 获取PyTorch基础设施指标

安装

npx skills add pytorch/pytorch --skill ci-metrics -g -y
更多选项

非标准路径

npx skills add https://github.com/pytorch/pytorch/tree/main/.claude/skills/ci-metrics -g -y

不安装直接使用

npx skills use pytorch/pytorch@ci-metrics

指定 Agent (Claude Code)

npx skills add pytorch/pytorch --skill ci-metrics -a claude-code -g -y

安装 repo 全部 skill

npx skills add pytorch/pytorch --all -g -y

预览 repo 内 skill

npx skills add pytorch/pytorch --list

SKILL.md

Frontmatter
{
    "name": "ci-metrics",
    "description": "Query PyTorch CI, GitHub Actions, HUD, Grafana, and infrastructure metrics. Use when users ask about CI duration, job failures, queue times, workflow trends, runner health, dashboard data, or PyTorch infrastructure metrics."
}

PyTorch CI Metrics

PyTorch CI and infrastructure metrics are exposed through Grafana. Use .claude/skills/ci-metrics/gcx-wrapper.sh for all Grafana access; it configures the PyTorch Grafana server, context, and authentication. Only users with write permission to the repo have access to Grafana. The authentication only provides read only access.

Requirements

The wrapper needs these tools on PATH:

  • gh - fetches the Grafana token and must be authenticated; if not, run gh auth login --hostname github.com --git-protocol ssh --web.
  • curl - downloads gcx and fetches the token from HUD.

On first use the wrapper downloads a pinned, checksum-verified gcx binary into a private cache (~/.cache/pytorch-ci-metrics/) and authenticates automatically. Nothing is installed on your PATH. If a tool is missing or gh is not authenticated, it exits with an error describing what to fix.

Datasources

Get the list of datasources available:

.claude/skills/ci-metrics/gcx-wrapper.sh datasources list

The data contains metrics for many repos owned by the PyTorch repo. When possible, restrict queries to just the pytorch/pytorch repository.

CI and Test Run Data

CI and test run data are stored in grafana-clickhouse-datasource. List all the available tables:

.claude/skills/ci-metrics/gcx-wrapper.sh datasources clickhouse list-tables

Important dataset:

  • GitHub webhook data
  • Tests
    • Database: tests
    • tests.all_test_runs - contains every test run. This is an extremely large table, so be considerate with filtering and timing.
    • Do not use tests.test_run_s3 as it contains partial data only.

To get additional guidance on common queries, clone https://github.com/pytorch/test-infra into a temporary directory and read the torchci folder.

Example Queries

Within the pytorch/pytorch repo on main, list the top most failing workflow jobs in the last 2 weeks:

.claude/skills/ci-metrics/gcx-wrapper.sh datasources clickhouse query "
  SELECT name, count(DISTINCT id) AS failures
  FROM default.workflow_job
  WHERE conclusion = 'failure'
    AND completed_at >= now() - INTERVAL 2 WEEK
    AND repository_full_name = 'pytorch/pytorch'
    AND head_branch = 'main'
  GROUP BY name ORDER BY failures DESC LIMIT 10"

For a test file, how many times was it run in the last week? How many times did it pass or fail?

.claude/skills/ci-metrics/gcx-wrapper.sh datasources clickhouse query "
  SELECT
    file,
    classname,
    name,
    count() AS runs,
    countIf(failure_count = 0 AND error_count = 0 AND skipped_count = 0) AS successful,
    countIf(failure_count > 0 OR error_count > 0) AS fails,
    countIf(skipped_count > 0) AS skipped
  FROM tests.all_test_runs
  WHERE time_inserted >= now() - INTERVAL 7 DAY
    AND file = 'lazy/test_ts_opinfo.py'
  GROUP BY file, classname, name
  ORDER BY runs DESC"

CI Infrastructure

CI infrastructure metrics are stored in grafanacloud-pytorchci-prom. To get a better understanding of the data, clone these repositories in a temporary directory:

Example Queries

Which runner types have the deepest queue right now (jobs assigned but not yet running)?

.claude/skills/ci-metrics/gcx-wrapper.sh datasources prometheus query -d grafanacloud-prom 'topk(10, clamp_min(sum by (name) (gha_assigned_jobs) - sum by (name) (gha_running_jobs), 0))'

How many jobs were running per cluster over the last 6 hours, sampled every 30 minutes? Use --since/--step (or --from/--to) for a range query:

.claude/skills/ci-metrics/gcx-wrapper.sh datasources prometheus query -d grafanacloud-prom 'sum by (cluster) (gha_running_jobs)' --since 6h --step 30m

版本历史

  • cb1ce48 当前 2026-08-20 19:56

同 Skill 集合

.claude/skills/add-uint-support/SKILL.md
.claude/skills/aoti-debug/SKILL.md
.claude/skills/at-dispatch-v2/SKILL.md
.claude/skills/cuda-index-width/SKILL.md
.claude/skills/distributed-triage/SKILL.md
.claude/skills/docstring/SKILL.md
.claude/skills/document-public-apis/SKILL.md
.claude/skills/fix-issue/SKILL.md
.claude/skills/ghstack-ci/SKILL.md
.claude/skills/metal-kernel/SKILL.md
.claude/skills/pr-review-readiness/SKILL.md
.claude/skills/pr-review/SKILL.md
.claude/skills/pt2-bug-basher/SKILL.md
.claude/skills/pyrefly-type-coverage/SKILL.md
.claude/skills/scrub-issue/SKILL.md
.claude/skills/skill-writer/SKILL.md
.claude/skills/triaging-issues/SKILL.md

元信息

文件数
0
版本
a05bc70
Hash
751b41ce
收录时间
2026-08-20 19:56

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-23 15:21
浙ICP备14020137号-1