diff --git a/experiments/perception/worker/Invoke-M49T1GSeg3DQualificationAsInteractiveUser.ps1 b/experiments/perception/worker/Invoke-M49T1GSeg3DQualificationAsInteractiveUser.ps1 new file mode 100644 index 0000000..ed5c6d6 --- /dev/null +++ b/experiments/perception/worker/Invoke-M49T1GSeg3DQualificationAsInteractiveUser.ps1 @@ -0,0 +1,62 @@ +[CmdletBinding()] +param( + [Parameter(Mandatory = $true)] + [string]$ReleaseRoot, + [Parameter(Mandatory = $true)] + [ValidatePattern("^[A-Za-z0-9._-]{1,96}$")] + [string]$RunId +) + +$ErrorActionPreference = "Stop" +$taskName = "MissionCore-M49T1GSeg3D" +$release = (Resolve-Path -LiteralPath $ReleaseRoot).Path +$payload = Join-Path $release "payload" +$runner = Join-Path $payload "Invoke-M49T1GSeg3DQualification.ps1" +if (-not (Test-Path -LiteralPath $runner -PathType Leaf)) { + throw "M49 T1 runner is missing" +} + +$existing = Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue +if ($existing -and $existing.State -eq "Running") { + throw "$taskName is already running" +} + +$powerShell = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" +$arguments = @( + "-NoLogo", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", + "-File", "`"$runner`"", + "-BuildContext", "`"$payload`"", + "-RunId", "`"$RunId`"" +) -join " " +$userId = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name +$action = New-ScheduledTaskAction ` + -Execute $powerShell ` + -Argument $arguments ` + -WorkingDirectory $payload +$principal = New-ScheduledTaskPrincipal ` + -UserId $userId ` + -LogonType Interactive ` + -RunLevel Limited +$trigger = New-ScheduledTaskTrigger -Once -At ((Get-Date).AddMinutes(30)) +$settings = New-ScheduledTaskSettingsSet ` + -AllowStartIfOnBatteries ` + -DontStopIfGoingOnBatteries ` + -StartWhenAvailable ` + -ExecutionTimeLimit ([TimeSpan]::FromHours(3)) + +Register-ScheduledTask ` + -TaskName $taskName ` + -Action $action ` + -Principal $principal ` + -Trigger $trigger ` + -Settings $settings ` + -Description "One-shot M49 T1 pinned GSeg3D upstream qualification." ` + -Force | Out-Null +Start-ScheduledTask -TaskName $taskName + +[pscustomobject]@{ + task_name = $taskName + run_id = $RunId + release_root = $release + state = (Get-ScheduledTask -TaskName $taskName).State.ToString() +} | ConvertTo-Json -Compress diff --git a/scripts/build_m49_t1_gseg3d_worker_artifact.py b/scripts/build_m49_t1_gseg3d_worker_artifact.py index 907dd5a..001fb89 100644 --- a/scripts/build_m49_t1_gseg3d_worker_artifact.py +++ b/scripts/build_m49_t1_gseg3d_worker_artifact.py @@ -19,6 +19,10 @@ SOURCES = ( Path("experiments/perception/worker/m49_t1_gseg3d/Dockerfile"), Path("experiments/perception/worker/m49_t1_gseg3d/qualify.sh"), Path("experiments/perception/worker/Invoke-M49T1GSeg3DQualification.ps1"), + Path( + "experiments/perception/worker/" + "Invoke-M49T1GSeg3DQualificationAsInteractiveUser.ps1" + ), Path("config/perception/m49-traversability-candidate-manifest-v1.json"), Path("config/perception/m49-camera-lidar-traversability-v1.json"), )