Skip to content

Commit 2e2ae2a

Browse files
committed
MSMPI: Implement multiple download attempts to workaround rate limits
1 parent 5da1177 commit 2e2ae2a

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

setup-msmpi.ps1

+20-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,27 @@ $tempdir = $Env:RUNNER_TEMP
88
$msmpisdk = Join-Path $tempdir msmpisdk.msi
99
$msmpisetup = Join-Path $tempdir msmpisetup.exe
1010

11+
function Download-File($url, $filename) {
12+
foreach ($i in 1..5) {
13+
try {
14+
Write-Host "Downloading ${url}"
15+
Invoke-WebRequest $url -OutFile $filename
16+
return
17+
}
18+
catch {
19+
$message = $_
20+
Write-Warning "${message}"
21+
Write-Host "Download failed, retrying ..."
22+
Start-Sleep -Seconds $i
23+
}
24+
}
25+
throw "Failed to download from ${url}"
26+
return $null
27+
}
28+
1129
Write-Host "Downloading Microsoft MPI $version"
12-
Invoke-WebRequest "$baseurl/msmpisdk.msi" -OutFile $msmpisdk
13-
Invoke-WebRequest "$baseurl/msmpisetup.exe" -OutFile $msmpisetup
30+
Download-File "$baseurl/msmpisdk.msi" $msmpisdk
31+
Download-File "$baseurl/msmpisetup.exe" $msmpisetup
1432

1533
Write-Host "Installing Microsoft MPI $version"
1634
Start-Process msiexec.exe -ArgumentList "/quiet /passive /qn /i $msmpisdk" -Wait

0 commit comments

Comments
 (0)