50 lines
1.4 KiB
PowerShell
50 lines
1.4 KiB
PowerShell
param(
|
|
[int]$Year = 2020,
|
|
[string]$ReportingDeadline = "",
|
|
[ValidateSet("month", "week")]
|
|
[string]$Granularity = "month",
|
|
[int]$PageSize = 500,
|
|
[int]$MaxPagesPerSet = 200,
|
|
[int]$SnapshotMaxRecordsPerSet = 5000,
|
|
[string[]]$Keyword = @(),
|
|
[string[]]$EntitySet = @(),
|
|
[string]$ProfileOutput = "",
|
|
[string]$SnapshotOutput = "",
|
|
[switch]$Strict
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$EnvName = "ndc_1c_mvp"
|
|
$EnvPython = Join-Path $env:USERPROFILE "miniconda3\envs\$EnvName\python.exe"
|
|
if (-not (Test-Path $EnvPython)) {
|
|
$EnvPython = Join-Path $env:USERPROFILE "Miniconda3\envs\$EnvName\python.exe"
|
|
}
|
|
if (-not (Test-Path $EnvPython)) {
|
|
throw "Python for env '$EnvName' not found. Expected: $EnvPython"
|
|
}
|
|
|
|
$Args = @(
|
|
"scripts/run_pre_report_snapshot.py",
|
|
"--year", $Year.ToString(),
|
|
"--granularity", $Granularity,
|
|
"--page-size", $PageSize.ToString(),
|
|
"--max-pages-per-set", $MaxPagesPerSet.ToString(),
|
|
"--snapshot-max-records-per-set", $SnapshotMaxRecordsPerSet.ToString()
|
|
)
|
|
|
|
if ($ReportingDeadline) { $Args += @("--reporting-deadline", $ReportingDeadline) }
|
|
if ($ProfileOutput) { $Args += @("--profile-output", $ProfileOutput) }
|
|
if ($SnapshotOutput) { $Args += @("--snapshot-output", $SnapshotOutput) }
|
|
if ($Strict) { $Args += "--strict" }
|
|
|
|
foreach ($Item in $Keyword) {
|
|
if ($Item) { $Args += @("--keyword", $Item) }
|
|
}
|
|
foreach ($Name in $EntitySet) {
|
|
if ($Name) { $Args += @("--entity-set", $Name) }
|
|
}
|
|
|
|
& $EnvPython @Args
|
|
exit $LASTEXITCODE
|