igneum/tools/intel-arc/pc1-node-wait.ps1
igneum-labs d7543a85e8 Intel Arc: the PC 1 node-wait and cards-watch jobs (read only) around the signed miners restart
After restart b the three workers sat faulted on "no status line from the miner for 90 s" (the node still syncing).
The chain: a read-only wait for node.synced and the exec tip (api/state and igneum_getExecStatus, 10 s, cap 10 min),
the signed restart --what miners kind (the app's own path for a faulted worker; a script never posts to api/cards),
and a read-only 3-minute watch of state, hash_now and message per card with the log tail of any card still faulted.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-07 10:19:11 +00:00

48 lines
3.2 KiB
PowerShell

# Igneum run job: wait for PC 1's node after a restart (machine ae432dc7), 7 October 2026 (branch intel-arc). READ ONLY,
# beside whatever runs: GET api/state every 10 s until node.synced is true, and the node's own eth JSON-RPC
# (127.0.0.1:26790, the default RPC port 26610 plus 180, config.rs evm_port) answers igneum_getExecStatus with an
# executed tip; cap 10 minutes; the timeline printed as RESULT lines. It never posts anything: the miners are restarted
# by the signed `restart --what miners` job the runner executes AFTER this one (the runner is serial), which is the
# app's own path for clearing a faulted worker. No api/* request other than GET api/state.
$ErrorActionPreference = 'Continue'
function Stamp { (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ') }
$started = Get-Date
$appDir = if ($env:IGNEUM_APP_DIR) { $env:IGNEUM_APP_DIR } else { Join-Path $env:LOCALAPPDATA 'igneum\app' }
$urlFile = Join-Path $appDir 'app.url'
"RESULT start $(Stamp) job=pc1-node-wait machine=$env:COMPUTERNAME app_version=$env:IGNEUM_APP_VERSION uptime_s=$([int]((Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime).TotalSeconds)"
$evmPort = 26790
if ($env:IGNEUM_APP_RPC_PORT) { try { $evmPort = [int]$env:IGNEUM_APP_RPC_PORT + 180 } catch { } }
function ExecTip {
try {
$body = '{"jsonrpc":"2.0","id":1,"method":"igneum_getExecStatus","params":[]}'
$r = Invoke-RestMethod -Uri "http://127.0.0.1:$evmPort" -Method POST -Body $body -ContentType 'application/json' -TimeoutSec 5
if ($r.result) { return "$($r.result.executedTipHash)|$($r.result.executedTipNumber)|$($r.result.startedFrom)" }
if ($r.error) { return "error:$($r.error.message)" }
return 'no result'
} catch { return "unreachable:$($_.Exception.Message)" }
}
$synced = $false; $tip = ''; $t = 0; $last = ''
while ($t -le 600) {
$line = ''
try {
if (Test-Path $urlFile) {
$url = (Get-Content -LiteralPath $urlFile -Raw).Trim()
$st = Invoke-RestMethod -Uri ($url + 'api/state') -Method GET -TimeoutSec 10
$n = $st.node
$cards = @($st.mining.cards); if (-not $cards) { $cards = @($st.cards) }
$cs = ($cards | Where-Object { $_.kind -ne 'integrated' } | ForEach-Object { "$($_.name -replace 'NVIDIA GeForce |AMD Radeon |Intel\(R\) Arc\(TM\) ', ''):$($_.state)" }) -join ' '
$line = "node=$($n.state) synced=$($n.synced) blocks=$($n.blocks) headers=$($n.headers) daa=$($n.daa) peers=$($n.peers) cards=[$cs]"
$synced = [bool]$n.synced
} else { $line = 'app.url absent (the app is not up yet)' }
} catch { $line = "api/state: $($_.Exception.Message)" }
$e = ExecTip
$full = "$line exec=$e"
if ($full -ne $last) { "RESULT t+${t}s $(Stamp) $full"; $last = $full }
$tip = $e
if ($synced -and $e -notmatch '^(unreachable|error|no result)' -and $e -notmatch '^\|' ) { break }
Start-Sleep -Seconds 10; $t += 10
}
$ok = $synced -and $tip -notmatch '^(unreachable|error|no result)' -and $tip -notmatch '^\|'
"RESULT end $(Stamp) waited_s=$t synced=$synced exec=$tip ready=$ok"
'SUMMARY ' + ([ordered]@{ job = 'pc1-node-wait'; status = $(if ($ok) { 'done' } else { 'partial' }); duration_s = [int]((Get-Date) - $started).TotalSeconds; finished_at = (Stamp); synced = $synced; exec = $tip; waited_s = $t } | ConvertTo-Json -Compress)
exit 0