File size: 2,118 Bytes
178f61f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
param(
    [Parameter(Mandatory = $true)]
    [int]$CacheBuilderProcessId,
    [string]$Python = "C:\Users\A\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe"
)

$ErrorActionPreference = "Stop"
$Root = "E:\Gaze_estimation"
$StatusPath = Join-Path $Root "artifacts\kd-teacher-trap-diagnostic\queued_preflight_status.json"
Set-Location -LiteralPath $Root

function Write-Status([string]$State, [string]$Detail) {
    $Value = [ordered]@{
        schema = "queued-kd-preflight-status-v1"
        state = $State
        detail = $Detail
        cache_builder_process_id = $CacheBuilderProcessId
        updated_utc = [DateTime]::UtcNow.ToString("o")
    }
    $Value | ConvertTo-Json | Set-Content -LiteralPath $StatusPath -Encoding UTF8
}

Write-Status "WAITING_FOR_CACHES" "Waiting for the exact remaining-cache orchestration process to exit"
Wait-Process -Id $CacheBuilderProcessId

$Participants = 0..14 | ForEach-Object { "p{0:D2}" -f $_ }
$Failures = @()
foreach ($Participant in $Participants) {
    $ValidationPath = Join-Path $Root "data\processed_kd_clean_v1\cache\$Participant.official448_pointkd.validation.json"
    if (-not (Test-Path -LiteralPath $ValidationPath)) {
        $Failures += "$Participant missing validation"
        continue
    }
    $Validation = Get-Content -LiteralPath $ValidationPath -Raw | ConvertFrom-Json
    if (-not $Validation.pass) {
        $Failures += "$Participant validation failed"
    }
}

if ($Failures.Count -gt 0) {
    Write-Status "BLOCKED_CACHE_INTEGRITY" ($Failures -join "; ")
    throw "cache integrity gate failed: $($Failures -join '; ')"
}

Write-Status "PREFLIGHT_RUNNING" "All 15 point-KD cache validations pass; starting 36 fixed-epoch runs"
& powershell -NoProfile -ExecutionPolicy Bypass -File scripts\run_three_subject_matched_preflight.ps1 -Python $Python -Epochs 50 -BatchSize 32
if ($LASTEXITCODE -ne 0) {
    Write-Status "BLOCKED_PREFLIGHT_FAILURE" "Three-subject matched preflight returned exit code $LASTEXITCODE"
    exit $LASTEXITCODE
}

Write-Status "PREFLIGHT_COMPLETE" "All 36 runs and the paired analysis completed"