Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/actions/teardown-win/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ runs:
run: |
.github\scripts\kill_active_ssh_sessions.ps1
- name: Clean up leftover processes on non-ephemeral Windows runner
uses: pytorch/test-infra/.github/actions/cleanup-runner@main

- name: Cleanup workspace
if: always()
shell: bash
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/_win-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ jobs:
outputs:
test-matrix: ${{ steps.filter.outputs.test-matrix }}
steps:
- name: Clean up leftover processes on non-ephemeral Windows runner
uses: pytorch/test-infra/.github/actions/cleanup-runner@main

- name: Setup SSH (Click me for login details)
uses: pytorch/test-infra/.github/actions/setup-ssh@main
with:
Expand Down
38 changes: 1 addition & 37 deletions .github/workflows/_win-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,43 +42,7 @@ jobs:
git config --global core.symlinks true

- name: Clean up leftover processes on non-ephemeral Windows runner
shell: powershell
continue-on-error: true
run: |
# This needs to be run before checking out PyTorch to avoid locking the working directory.
# Below is the list of commands that could lock $GITHUB_WORKSPACE gathered from sysinternals
# handle tool
$processes = "python", "ninja", "cl", "nvcc", "cmd"
Foreach ($process In $processes) {
Try {
# https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/stop-process
Get-Process -Name $process -ErrorAction Stop | Stop-Process -Force
}
Catch {
Write-Output "No leftover $process process, continuing"
Write-Output $_
}
}

# Try it again https://stackoverflow.com/questions/40585754/powershell-wont-terminate-hung-process
# for hung processes
Foreach ($process In $processes) {
Try {
(Get-WmiObject -Class Win32_Process -Filter "Name LIKE '${process}%'").terminate()
}
Catch {
Write-Output $_
}
}

Try {
# Print all the processes for debugging
Wmic Path Win32_Process Get Caption,Processid,Commandline | Format-List
}
Catch {
# Better to write out whatever exception thrown to help debugging any potential issue
Write-Output $_
}
uses: pytorch/test-infra/.github/actions/cleanup-runner@main

- name: Setup SSH (Click me for login details)
uses: pytorch/test-infra/.github/actions/setup-ssh@main
Expand Down