65 lines
2.0 KiB
PowerShell
65 lines
2.0 KiB
PowerShell
[CmdletBinding()]
|
|
param(
|
|
[string]$SourceDir = '',
|
|
[string]$OutputDir = '',
|
|
[string]$BusinessDate = (Get-Date -Format 'yyyy-MM-dd'),
|
|
[string]$ScheduleStart = '',
|
|
[string]$DueDate = '',
|
|
[switch]$NoAssumeKitted,
|
|
[switch]$SkipStrictCheck
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
$env:PYTHONIOENCODING = 'utf-8'
|
|
|
|
$repoRoot = Split-Path -Parent $PSScriptRoot
|
|
if (-not $SourceDir) {
|
|
$SourceDir = if ($env:RUIYANG_DEMO_DIR) {
|
|
$env:RUIYANG_DEMO_DIR
|
|
} else {
|
|
Join-Path $repoRoot 'demo-data\ruiyang-source'
|
|
}
|
|
}
|
|
if (-not $OutputDir) {
|
|
$OutputDir = Join-Path $repoRoot 'outputs\ruiyang-demo'
|
|
}
|
|
if (-not $ScheduleStart) {
|
|
$ScheduleStart = ([DateTime]::ParseExact($BusinessDate, 'yyyy-MM-dd', $null).AddDays(1)).ToString('yyyy-MM-dd')
|
|
}
|
|
if (-not $DueDate) {
|
|
$DueDate = ([DateTime]::ParseExact($BusinessDate, 'yyyy-MM-dd', $null).AddDays(30)).ToString('yyyy-MM-dd')
|
|
}
|
|
|
|
$argsList = @(
|
|
(Join-Path $PSScriptRoot 'ruiyang_demo.py'),
|
|
'--source-dir', $SourceDir,
|
|
'--output-dir', $OutputDir,
|
|
'--business-date', $BusinessDate,
|
|
'--schedule-start', $ScheduleStart,
|
|
'--due-date', $DueDate
|
|
)
|
|
if ($NoAssumeKitted) { $argsList += '--no-assume-kitted' }
|
|
if ($SkipStrictCheck) { $argsList += '--skip-strict-check' }
|
|
|
|
Write-Host "[Ruiyang] Source: $SourceDir"
|
|
Write-Host "[Ruiyang] Output: $OutputDir"
|
|
Write-Host "[Ruiyang] Business: $BusinessDate"
|
|
Write-Host "[Ruiyang] Schedule: $ScheduleStart"
|
|
Write-Host "[Ruiyang] Due: $DueDate"
|
|
|
|
& python @argsList
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "Ruiyang demo pipeline failed with exit code $LASTEXITCODE"
|
|
}
|
|
|
|
& python (Join-Path $PSScriptRoot 'verify_ruiyang_demo.py') `
|
|
--output-dir $OutputDir `
|
|
--expected-source-dir $SourceDir `
|
|
--business-date $BusinessDate
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "Ruiyang demo artifact verification failed with exit code $LASTEXITCODE"
|
|
}
|
|
|
|
Write-Host "[Ruiyang] Generated and verified. Open: $(Join-Path $OutputDir 'summary.json')"
|