Skip to content

tools: Update clear_offline_runners to clear ec2 #6721

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

Merged
merged 5 commits into from
Jun 6, 2025

Conversation

seemethere
Copy link
Member

@seemethere seemethere commented Jun 6, 2025

We recently had an outage that required that we spin down all instances that were not actively connected to GitHub.

Requirements to run:

  • Valid AWS credentials
  • GITHUB_TOKEN with permissions to view self hosted runners for an organization

To run you can use:

pip install -r tools/self-hosted-runner-utils/requirements.txt
# To dry run first, pay attention to outputted numbers
python3 tools/self-hosted-runner-utils/clear_offline_runners.py --dry-run pytorch
# To do actual work
python3 tools/self-hosted-runner-utils/clear_offline_runners.py pytorch

This was used to remediate issues from pytorch/pytorch#155265

We recently had an outage that required that we spin down all instances
that were not actively connected to GitHub.

Signed-off-by: Eli Uriegas <[email protected]>
Copy link

vercel bot commented Jun 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
torchci ⬜️ Ignored (Inspect) Visit Preview Jun 6, 2025 5:28pm

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 6, 2025
@seemethere seemethere requested review from zxiiro and a team June 6, 2025 15:38
Signed-off-by: Eli Uriegas <[email protected]>
Signed-off-by: Eli Uriegas <[email protected]>
Github,
PaginatedList,
SelfHostedActionsRunner,
)
from tqdm import tqdm # type: ignore[import-untyped]


Copy link
Collaborator

Choose a reason for hiding this comment

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

Github won't let me propose changes to lines that didn't change :(

Adding a new argument for runner_name below would be useful as LF account has a different action runner name.

    parser.add_argument(
        "--runner-name",
        help="AWS Runner Name to filter for EC2 instances.",
        type=str,
        default="gh-ci-action-runner",
    )

@seemethere
Copy link
Member Author

The linter issues are not my issues, will follow up with a PR to fix most of them

@seemethere seemethere merged commit 5a68935 into main Jun 6, 2025
5 of 6 checks passed
@seemethere seemethere deleted the seemethere/add_clear_offline_runners branch June 6, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants