Files
skillfactor-pipeline/pipeline/run-enrichment-night.ps1
skillfactor-pipeline af05383bb1 chore: v1 baseline - full 3,039-package catalog with AI-skill enrichment and O*NET backfill
Snapshot before the quality program (relevance gates, tiered mapping,
QA linter). v1 is the immutable before/after reference; evidence crawl
was at ~175/3039 occupations when tagged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PDKeXvpT6tENSvyQGLV1Uq
2026-07-09 05:32:49 +02:00

77 lines
3.3 KiB
PowerShell

# Nacht-Orchestrierung: wartet auf den laufenden Push-Loop, führt dann
# AI-Skill-Enrichment + Provenance-Rebuild aus, startet Gitea neu
# (aktiviert den custom/footer.tmpl-Fix -> Mermaid-Pies rendern wieder)
# und re-pusht den kompletten Katalog.
#
# Start (detached):
# Start-Process powershell -WindowStyle Hidden -ArgumentList
# '-ExecutionPolicy Bypass -File C:\dev\skillfactor\pipeline\run-enrichment-night.ps1'
$ErrorActionPreference = "Continue"
$dev = "C:\dev\skillfactor"
$py = "$dev\.venv\Scripts\python.exe"
$gitea = "C:\Program Files (x86)\TempoBill\Zeiterfassung.Cloud\Tools\gitea"
$log = "$dev\docs\logs\enrichment_night.log"
function Log($m) {
"$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') $m" | Out-File $log -Append -Encoding utf8
}
Log "=== enrichment night run started ==="
# ── 1. Auf laufenden Push-Loop warten (Wrapper push_loop.ps1 + python) ──────
Log "waiting for active push loop (push_loop.ps1 / batch_run)..."
while ($true) {
$running = Get-WmiObject Win32_Process |
Where-Object { $_.CommandLine -match "push_loop\.ps1|batch_run" }
if (-not $running) { break }
Start-Sleep -Seconds 60
}
Log "push loop finished."
# ── 2. Enrichment (alle Pakete) ──────────────────────────────────────────────
Set-Location $dev
cmd /c "`"$py`" pipeline\p5_enrich_ai_skills.py >> `"$log`" 2>&1"
Log "p5_enrich_ai_skills done (exit $LASTEXITCODE)"
# ── 3. Provenance-Rebuild (PROVENANCE.md + manifest, neue Kategorie) ─────────
cmd /c "`"$py`" pipeline\p3d_provenance.py >> `"$log`" 2>&1"
Log "p3d_provenance done (exit $LASTEXITCODE)"
# ── 4. Gitea-Neustart (Footer-Template-Fix: index.js laedt wieder) ───────────
Log "restarting gitea (template fix)..."
Stop-Process -Name gitea -Force -ErrorAction SilentlyContinue
Start-Sleep -Seconds 15
& "$gitea\start-gitea.ps1" | Out-Null
$deadline = (Get-Date).AddMinutes(90) # Schemaabgleich kann lange dauern
$healthy = $false
while ((Get-Date) -lt $deadline) {
try {
$r = Invoke-WebRequest -Uri "http://127.0.0.1:3300/api/healthz" -UseBasicParsing -TimeoutSec 10
if ($r.StatusCode -eq 200) { $healthy = $true; break }
} catch {}
Start-Sleep -Seconds 30
}
if ($healthy) {
Log "gitea healthy again."
} else {
Log "WARN: gitea not healthy after 90 min - continuing anyway (pushes will retry/fail visibly)"
}
# ── 5. Alle 'done' auf Re-Push zuruecksetzen ─────────────────────────────────
cmd /c "`"$py`" pipeline\reset_push_status.py >> `"$log`" 2>&1"
Log "reset_push_status done (exit $LASTEXITCODE)"
# ── 6. Kompletten Katalog re-pushen (resilienter Wrapper, restartet Crashes) ─
Log "starting full re-push via push_loop.ps1..."
& powershell -NonInteractive -ExecutionPolicy Bypass -File "$dev\push_loop.ps1" *>> $log
Log "re-push finished"
# ── 7. Marketplace + Industrie-Index aktualisieren ───────────────────────────
cmd /c "`"$py`" pipeline\push_marketplace.py >> `"$log`" 2>&1"
Log "marketplace pushed (exit $LASTEXITCODE)"
cmd /c "`"$py`" pipeline\p4c_industry_index.py >> `"$log`" 2>&1"
Log "industry index pushed (exit $LASTEXITCODE)"
Log "=== enrichment night run COMPLETE ==="