parallel execution
This commit is contained in:
1 parent
e5c264d3ab
commit
3dbd75bbca
1 file changed
+30
-18
+30
-18
@@ -147,9 +147,10 @@ export def "skyg remote boot-all" [
|
|||||||
mut failures = []
|
mut failures = []
|
||||||
mut skipped = []
|
mut skipped = []
|
||||||
|
|
||||||
|
# Phase 1: sequential SSH reachability checks (fast)
|
||||||
|
mut online_hosts = []
|
||||||
for host in $all_hosts {
|
for host in $all_hosts {
|
||||||
print $"\n=== Checking ($host) ==="
|
print $"\n=== Checking ($host) ==="
|
||||||
# Check online via SSH reachability (hosts use Tailscale; plain ping often fails to resolve)
|
|
||||||
let target = $"root@($host).lab.internal"
|
let target = $"root@($host).lab.internal"
|
||||||
let is_online = (try {
|
let is_online = (try {
|
||||||
bash -c $"ssh -o BatchMode=yes -o ConnectTimeout=3 -o StrictHostKeyChecking=accept-new ($target) 'true' >/dev/null 2>&1"
|
bash -c $"ssh -o BatchMode=yes -o ConnectTimeout=3 -o StrictHostKeyChecking=accept-new ($target) 'true' >/dev/null 2>&1"
|
||||||
@@ -159,26 +160,36 @@ export def "skyg remote boot-all" [
|
|||||||
if not $is_online {
|
if not $is_online {
|
||||||
print $"(ansi yellow)OFFLINE(ansi reset): ($host)"
|
print $"(ansi yellow)OFFLINE(ansi reset): ($host)"
|
||||||
$skipped = ($skipped | append $host)
|
$skipped = ($skipped | append $host)
|
||||||
continue
|
} else {
|
||||||
|
print $"(ansi green)ONLINE(ansi reset): ($host) - will boot via ($build_host)"
|
||||||
|
$online_hosts = ($online_hosts | append $host)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print $"(ansi green)ONLINE(ansi reset): ($host) - running boot via ($build_host)"
|
# Phase 2: run boots in parallel (2 concurrent)
|
||||||
let cmd = $"skyg remote boot --build-host ($build_host) ($host)"
|
if ($online_hosts | length) > 0 {
|
||||||
print $cmd
|
print "
|
||||||
|
Starting parallel boots (concurrency: 2)..."
|
||||||
let result = (try {
|
let boot_results = ($online_hosts | par-each --threads 2 { |host|
|
||||||
bash -c $cmd
|
let cmd = $"skyg remote boot --build-host ($build_host) ($host)"
|
||||||
true
|
print $cmd
|
||||||
} catch {
|
let ok = (try {
|
||||||
false
|
bash -c $cmd
|
||||||
|
true
|
||||||
|
} catch {
|
||||||
|
false
|
||||||
|
})
|
||||||
|
{host: $host, success: $ok}
|
||||||
})
|
})
|
||||||
|
|
||||||
if $result {
|
for r in $boot_results {
|
||||||
$successes = ($successes | append $host)
|
if $r.success {
|
||||||
print $"(ansi green)SUCCESS(ansi reset): ($host)"
|
$successes = ($successes | append $r.host)
|
||||||
} else {
|
print $"(ansi green)SUCCESS(ansi reset): ($r.host)"
|
||||||
$failures = ($failures | append $host)
|
} else {
|
||||||
print $"(ansi red)FAILED(ansi reset): ($host)"
|
$failures = ($failures | append $r.host)
|
||||||
|
print $"(ansi red)FAILED(ansi reset): ($r.host)"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +209,8 @@ Details:
|
|||||||
"
|
"
|
||||||
|
|
||||||
$report | save -f $report_file
|
$report | save -f $report_file
|
||||||
print $"\nReport written to ($report_file)"
|
print $"
|
||||||
|
Report written to ($report_file)"
|
||||||
print $report
|
print $report
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user