[PRISM] Night: export raw-night then shutdown only after successful sync
lint / hygiene (push) Failing after 28s
lint / hygiene (push) Failing after 28s
This commit is contained in:
1 parent
07a1976f98
commit
3fe1657fd6
2 files changed
+18
-3
No files matched your search
@@ -1,5 +1,5 @@
|
||||
param(
|
||||
[switch]$Now
|
||||
[switch]$Shutdown
|
||||
)
|
||||
$ErrorActionPreference = "Continue"
|
||||
$base = "D:\Buryans Hub\sources\plan\research-pack"
|
||||
@@ -49,3 +49,13 @@ if ($ready.Count -gt 0) {
|
||||
Log "extractor exit $LASTEXITCODE"
|
||||
}
|
||||
Log "=== night sprint done ==="
|
||||
if ($Shutdown) {
|
||||
Log "export before shutdown"
|
||||
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File (Join-Path $base "sync-to-host.ps1")
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Log "export ok; shutdown in 60s"
|
||||
shutdown.exe /s /t 60 /c "Prism night sprint complete"
|
||||
} else {
|
||||
Log "export failed; PC stays on for manual transfer"
|
||||
}
|
||||
}
|
||||
@@ -6,17 +6,22 @@ $log = Join-Path $base "sync-to-host.log"
|
||||
function Log($m) { Add-Content -Path $log -Value "$(Get-Date -Format s) $m" }
|
||||
if (-not (Test-NetConnection $hostIp -Port 22 -InformationLevel Quiet -WarningAction SilentlyContinue)) {
|
||||
Log "host unreachable"
|
||||
exit 0
|
||||
exit 1
|
||||
}
|
||||
Log "host reachable, copying"
|
||||
$remote = "/tmp/prism-import"
|
||||
try {
|
||||
ssh -o BatchMode=yes -o StrictHostKeyChecking=no root@$hostIp "mkdir -p $remote" | Out-Null
|
||||
scp -o BatchMode=yes -o StrictHostKeyChecking=no -r (Join-Path $base "pc-results-merged-clean") "root@${hostIp}:$remote/" | Out-Null
|
||||
if (Test-Path (Join-Path $base "pc-results-night")) {
|
||||
scp -o BatchMode=yes -o StrictHostKeyChecking=no -r (Join-Path $base "pc-results-night") "root@${hostIp}:$remote/" | Out-Null
|
||||
}
|
||||
scp -o BatchMode=yes -o StrictHostKeyChecking=no (Join-Path $base "yealink-current-staging.yaml") "root@${hostIp}:$remote/" | Out-Null
|
||||
scp -o BatchMode=yes -o StrictHostKeyChecking=no (Join-Path $base "other-vendors-staging.yaml") "root@${hostIp}:$remote/" | Out-Null
|
||||
ssh -o BatchMode=yes -o StrictHostKeyChecking=no root@$hostIp "cd /root/buryan-infra; mkdir -p ops/combine/staging/ingest-pc-clean; cp $remote/yealink-current-staging.yaml $remote/other-vendors-staging.yaml ops/combine/staging/ingest-pc-clean/; /opt/work-hub/venv/bin/python ops/combine/research-pack/ingest_extracted.py --in $remote/pc-results-merged-clean --out ops/combine/staging/ingest-pc-clean >> /tmp/prism-sync.log 2>&1; echo done" | Out-Null
|
||||
ssh -o BatchMode=yes -o StrictHostKeyChecking=no root@$hostIp "cd /root/buryan-infra; mkdir -p ops/combine/staging/ingest-pc-clean; cp $remote/yealink-current-staging.yaml $remote/other-vendors-staging.yaml ops/combine/staging/ingest-pc-clean/; if [ -d $remote/pc-results-night ]; then rm -rf ops/combine/staging/raw-night; cp -r $remote/pc-results-night ops/combine/staging/raw-night; fi; /opt/work-hub/venv/bin/python ops/combine/research-pack/ingest_extracted.py --in $remote/pc-results-merged-clean --out ops/combine/staging/ingest-pc-clean >> /tmp/prism-sync.log 2>&1; echo done" | Out-Null
|
||||
Log "ingested"
|
||||
exit 0
|
||||
} catch {
|
||||
Log "sync failed: $($_.Exception.Message)"
|
||||
exit 1
|
||||
}
|
||||
Reference in new issue
Block a user