Skip to content

Commit

Permalink
Trying some different logic based on an article from 2018
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmundt committed Mar 4, 2025
1 parent dac551f commit a6399ab
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 24 deletions.
32 changes: 20 additions & 12 deletions .github/workflows/test_branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -385,19 +385,27 @@ jobs:
for PKG in $PACKAGES; do
if [[ "${{matrix.TARGET}}" == win ]]; then
powershell -Command "
$process = Start-Process conda -ArgumentList 'install', '-q', '-y', '$PKG' -NoNewWindow -PassThru;
$timeout = 30;
$startTime = Get-Date;
while (-not $process.HasExited) {
Start-Sleep -Seconds 1;
if ((Get-Date) - $startTime -gt [TimeSpan]::FromSeconds($timeout)) {
Stop-Process -Id $process.Id -Force;
Write-Host 'WARNING: $PKG installation timed out';
break;
}
# Set the timeout duration (in seconds)
$Timeout = 30
$RetryInterval = 1
$timer = [Diagnostics.Stopwatch]::StartNew()
# Start the process
$process = Start-Process -FilePath conda -ArgumentList 'install', '-q', '-y', '$PKG' -NoNewWindow -PassThru
# Monitor the process
while (($timer.Elapsed.TotalSeconds -lt $Timeout) -and (-not $process.HasExited)) {
Start-Sleep -Seconds $RetryInterval
$totalSecs = [math]::Round($timer.Elapsed.TotalSeconds, 0)
Write-Host \"Still waiting for $PKG installation... [$totalSecs seconds elapsed]\"
}
if ($process.HasExited -and $process.ExitCode -ne 0) {
Write-Host 'WARNING: $PKG not available or did not install correctly';
$timer.Stop()
if (-not $process.HasExited) {
Stop-Process -Id $process.Id -Force
Write-Host \"WARNING: $PKG installation timed out after $Timeout seconds\"
} elseif ($process.ExitCode -ne 0) {
Write-Host \"WARNING: $PKG installation failed with exit code $($process.ExitCode)\"
} else {
Write-Host \"SUCCESS: $PKG installed successfully\"
}
"
else
Expand Down
32 changes: 20 additions & 12 deletions .github/workflows/test_pr_and_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -422,19 +422,27 @@ jobs:
for PKG in $PACKAGES; do
if [[ "${{matrix.TARGET}}" == win ]]; then
powershell -Command "
$process = Start-Process conda -ArgumentList 'install', '-q', '-y', '$PKG' -NoNewWindow -PassThru;
$timeout = 30;
$startTime = Get-Date;
while (-not $process.HasExited) {
Start-Sleep -Seconds 1;
if ((Get-Date) - $startTime -gt [TimeSpan]::FromSeconds($timeout)) {
Stop-Process -Id $process.Id -Force;
Write-Host 'WARNING: $PKG installation timed out';
break;
}
# Set the timeout duration (in seconds)
$Timeout = 30
$RetryInterval = 1
$timer = [Diagnostics.Stopwatch]::StartNew()
# Start the process
$process = Start-Process -FilePath conda -ArgumentList 'install', '-q', '-y', '$PKG' -NoNewWindow -PassThru
# Monitor the process
while (($timer.Elapsed.TotalSeconds -lt $Timeout) -and (-not $process.HasExited)) {
Start-Sleep -Seconds $RetryInterval
$totalSecs = [math]::Round($timer.Elapsed.TotalSeconds, 0)
Write-Host \"Still waiting for $PKG installation... [$totalSecs seconds elapsed]\"
}
if ($process.HasExited -and $process.ExitCode -ne 0) {
Write-Host 'WARNING: $PKG not available or did not install correctly';
$timer.Stop()
if (-not $process.HasExited) {
Stop-Process -Id $process.Id -Force
Write-Host \"WARNING: $PKG installation timed out after $Timeout seconds\"
} elseif ($process.ExitCode -ne 0) {
Write-Host \"WARNING: $PKG installation failed with exit code $($process.ExitCode)\"
} else {
Write-Host \"SUCCESS: $PKG installed successfully\"
}
"
else
Expand Down

0 comments on commit a6399ab

Please sign in to comment.