44 lines
3.3 KiB
PowerShell
44 lines
3.3 KiB
PowerShell
param([int]$TextWorkers = 4, [switch]$Resume)
|
|
$ErrorActionPreference = 'Stop'
|
|
$productionRepo = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../..'))
|
|
Set-Location -LiteralPath $productionRepo
|
|
$productionRoot = Join-Path $productionRepo 'data/tts-pilot/corpus50000-20261114'
|
|
$productionJava = 'C:/Users/Administrator/.jdks/ms-17.0.19/bin/java.exe'
|
|
$productionJavac = 'C:/Users/Administrator/.jdks/ms-17.0.19/bin/javac.exe'
|
|
$productionPython = 'C:/Users/Administrator/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/python.exe'
|
|
$productionClassPath = (Resolve-Path 'cmvr-iot-tts/target/classes').Path + ';' + (Resolve-Path 'cmvr-iot-common/target/classes').Path + ';' + [IO.File]::ReadAllText((Resolve-Path 'cmvr-iot-tts/target/runtime-classpath.txt')).Trim() + ';C:/Users/Administrator/.m2/repository/com/mysql/mysql-connector-j/9.7.0/mysql-connector-j-9.7.0.jar'
|
|
$env:PYTHONIOENCODING = 'utf-8'
|
|
New-Item -ItemType Directory -Path $productionRoot -Force | Out-Null
|
|
[IO.File]::WriteAllText((Join-Path $productionRoot 'orchestrator.pid'), [string]$PID)
|
|
function Set-ProductionPhase([string]$Phase, [string]$Detail = '') {
|
|
$productionPhase = [ordered]@{ phase = $Phase; detail = $Detail; updated_at = [DateTimeOffset]::Now.ToString('o'); pid = $PID }
|
|
[IO.File]::WriteAllText((Join-Path $productionRoot 'orchestrator.json'), ($productionPhase | ConvertTo-Json))
|
|
}
|
|
try {
|
|
Set-ProductionPhase 'CHECKING'
|
|
& $productionJavac -encoding UTF-8 -cp $productionClassPath -d 'cmvr-iot-tts/target' 'tools/corpus/CorpusDatabase.java' 'tools/corpus/CorpusProduction.java'
|
|
if ($LASTEXITCODE -ne 0) { throw 'Production compilation failed' }
|
|
$productionClassPath = 'cmvr-iot-tts/target;' + $productionClassPath
|
|
& $productionJava '-Dfile.encoding=UTF-8' -cp $productionClassPath CorpusProduction self-test
|
|
if ($LASTEXITCODE -ne 0) { throw 'Quality gate self-test failed' }
|
|
& $productionJava '-Dfile.encoding=UTF-8' -cp $productionClassPath CorpusProduction database-preflight
|
|
if ($LASTEXITCODE -ne 0) { throw 'Database preflight failed' }
|
|
if (-not $Resume) {
|
|
Set-ProductionPhase 'PREPARING_TEXT' '生成并独立复核中文及五种外语文本;尚未调用正式批次的付费合成。'
|
|
& $productionPython -u 'tools/corpus/prepare_corpus.py' prepare --workers $TextWorkers
|
|
if ($LASTEXITCODE -ne 0) { throw 'Text preparation stopped; inspect preparation evidence before restarting' }
|
|
}
|
|
& $productionJava '-Dfile.encoding=UTF-8' -cp $productionClassPath CorpusProduction check
|
|
if ($LASTEXITCODE -ne 0) { throw 'Reviewed 50000-record plan verification failed' }
|
|
if (Test-Path -LiteralPath (Join-Path $productionRoot 'STOP')) { Set-ProductionPhase 'STOP_REQUESTED'; exit 0 }
|
|
Set-ProductionPhase 'SYNTHESIZING' '语料已通过检查;按发音人和语种逐条合成、校验、存储并入库。'
|
|
& $productionJava '-Dfile.encoding=UTF-8' -cp $productionClassPath CorpusProduction run
|
|
if ($LASTEXITCODE -ne 0) { throw 'Synthesis stopped; paid requests will not be automatically retried' }
|
|
$productionProgress = Get-Content -LiteralPath (Join-Path $productionRoot 'progress.json') -Raw | ConvertFrom-Json
|
|
Set-ProductionPhase $productionProgress.state
|
|
} catch {
|
|
Set-ProductionPhase 'STOPPED_ON_ERROR' $_.Exception.Message
|
|
Write-Error $_
|
|
exit 1
|
|
}
|