|
|
@@ -116,8 +116,8 @@ if (-not $GuiOnly) {
|
|
|
if ($LASTEXITCODE -ne 0) { Write-Fail "docker compose up failed" }
|
|
|
Write-OK "Containers started"
|
|
|
|
|
|
- # -- 5. Native spectrometer (real mode only) --------------------------------
|
|
|
- if ($Mode -eq "real" -and -not $SkipSpectrometer) {
|
|
|
+ # -- 5. Native spectrometer ------------------------------------------------
|
|
|
+ if (-not $SkipSpectrometer) {
|
|
|
Write-Step "Starting native spectrometer"
|
|
|
$SpecDir = Join-Path $Root "services\spectrometer"
|
|
|
$SpecVenv = Join-Path $SpecDir "mvenv\Scripts\python.exe"
|
|
|
@@ -146,28 +146,35 @@ if (-not $GuiOnly) {
|
|
|
Write-OK "Migrations applied"
|
|
|
|
|
|
if (Test-Path $PicoExe) {
|
|
|
- Start-Process $PicoExe -WindowStyle Hidden
|
|
|
- Write-OK "pico-tcp.exe started"
|
|
|
+ Start-Process $PicoExe -WindowStyle Normal
|
|
|
+ Write-OK "pico-tcp.exe started (visible window)"
|
|
|
} else {
|
|
|
Write-Warn "bin\pico-tcp.exe not found -- ADC proxy not started"
|
|
|
}
|
|
|
|
|
|
- $running = Get-Process -Name python* -ErrorAction SilentlyContinue |
|
|
|
- Where-Object { $_.CommandLine -like "*manage.py*runserver*" }
|
|
|
- if ($running) {
|
|
|
- Write-OK "Spectrometer already running (PID $($running.Id))"
|
|
|
+ # Check if runserver is already up by probing port 8000
|
|
|
+ $specPort = Get-EnvPort "SPECTROMETER_PORT" "8000"
|
|
|
+ $alreadyUp = $false
|
|
|
+ try {
|
|
|
+ $r = Invoke-WebRequest "http://localhost:$specPort/api/" `
|
|
|
+ -UseBasicParsing -TimeoutSec 2 -ErrorAction Stop
|
|
|
+ $alreadyUp = ($r.StatusCode -lt 400)
|
|
|
+ } catch {}
|
|
|
+
|
|
|
+ if ($alreadyUp) {
|
|
|
+ Write-OK "Spectrometer already responding on port $specPort"
|
|
|
} else {
|
|
|
Start-Process $SpecVenv `
|
|
|
- -ArgumentList "manage.py runserver 0.0.0.0:8000" `
|
|
|
+ -ArgumentList "manage.py runserver 0.0.0.0:$specPort" `
|
|
|
-WorkingDirectory $SpecDir `
|
|
|
-WindowStyle Normal
|
|
|
- Write-OK "Spectrometer started in new window"
|
|
|
+ Write-OK "Spectrometer started in new window (port $specPort)"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
# -- 6. Health check -------------------------------------------------------
|
|
|
Write-Step "Waiting for services to become healthy"
|
|
|
- $checkSpec = ($Mode -eq "real") -and (-not $SkipSpectrometer)
|
|
|
+ $checkSpec = -not $SkipSpectrometer
|
|
|
$services = @(
|
|
|
@{ Name = "Orchestrator"; Url = "http://localhost:$(Get-EnvPort 'ORCHESTRATOR_PORT' '1717')/health"; Required = $true },
|
|
|
@{ Name = "Seq-Interp"; Url = "http://localhost:$(Get-EnvPort 'SEQ_INTERP_PORT' '7475')/health"; Required = $true },
|
|
|
@@ -252,7 +259,7 @@ Write-Host "============================================================" -Foreg
|
|
|
Write-Host (" LF-MRI platform is running [{0} mode]" -f $Mode.ToUpper()) -ForegroundColor Green
|
|
|
Write-Host "============================================================" -ForegroundColor Green
|
|
|
Write-Host ""
|
|
|
-if ($Mode -eq "real") {
|
|
|
+if (-not $SkipSpectrometer) {
|
|
|
Write-Host " Stop spectrometer: close the spectrometer terminal window"
|
|
|
Write-Host " Stop pico-tcp: services\spectrometer\autokill.bat"
|
|
|
}
|