| | | 1 | | using System.ComponentModel; |
| | | 2 | | using Spectre.Console; |
| | | 3 | | using Spectre.Console.Cli; |
| | | 4 | | |
| | | 5 | | namespace Orchestrator.Commands.Observability.Experiments; |
| | | 6 | | |
| | | 7 | | public sealed class RunCommunityToDateSettings : CommandSettings |
| | | 8 | | { |
| | | 9 | | [CommandOption("--manifest")] |
| | | 10 | | [Description("Path to the prepared community-to-date manifest JSON file")] |
| | 1 | 11 | | public string ManifestPath { get; set; } = string.Empty; |
| | | 12 | | |
| | | 13 | | [CommandOption("--run-family-name")] |
| | | 14 | | [Description("Optional base name used to derive one Langfuse dataset run name per participant")] |
| | | 15 | | public string? RunFamilyName { get; set; } |
| | | 16 | | |
| | | 17 | | [CommandOption("--run-description")] |
| | | 18 | | [Description("Optional Langfuse dataset run description applied to all participant runs")] |
| | | 19 | | public string? RunDescription { get; set; } |
| | | 20 | | |
| | | 21 | | [CommandOption("--dataset-name")] |
| | | 22 | | [Description("Optional hosted dataset name override")] |
| | | 23 | | public string? DatasetName { get; set; } |
| | | 24 | | |
| | | 25 | | [CommandOption("--batch-size")] |
| | | 26 | | [Description("Optional batch size override used within each participant run")] |
| | | 27 | | [DefaultValue(25)] |
| | 1 | 28 | | public int BatchSize { get; set; } = 25; |
| | | 29 | | |
| | | 30 | | [CommandOption("--participant-limit")] |
| | | 31 | | [Description("Optional limit for the number of participant runs to execute, ordered by display name")] |
| | | 32 | | public int? ParticipantLimit { get; set; } |
| | | 33 | | |
| | | 34 | | [CommandOption("--participant-ids")] |
| | | 35 | | [Description("Optional comma-separated participant ids to execute. When omitted, all manifest participants are used" |
| | | 36 | | public string? ParticipantIds { get; set; } |
| | | 37 | | |
| | | 38 | | [CommandOption("--replace-runs")] |
| | | 39 | | [Description("Delete existing participant dataset runs with the same derived names before starting")] |
| | | 40 | | [DefaultValue(false)] |
| | | 41 | | public bool ReplaceRuns { get; set; } |
| | | 42 | | |
| | | 43 | | public override ValidationResult Validate() |
| | | 44 | | { |
| | 1 | 45 | | if (string.IsNullOrWhiteSpace(ManifestPath)) |
| | | 46 | | { |
| | 0 | 47 | | return ValidationResult.Error("--manifest is required"); |
| | | 48 | | } |
| | | 49 | | |
| | 1 | 50 | | if (BatchSize < 1) |
| | | 51 | | { |
| | 0 | 52 | | return ValidationResult.Error("--batch-size must be at least 1"); |
| | | 53 | | } |
| | | 54 | | |
| | 1 | 55 | | if (ParticipantLimit is < 1) |
| | | 56 | | { |
| | 0 | 57 | | return ValidationResult.Error("--participant-limit must be at least 1 when provided"); |
| | | 58 | | } |
| | | 59 | | |
| | 1 | 60 | | if (ParticipantIds is not null && GetParticipantIdFilter().Count == 0) |
| | | 61 | | { |
| | 0 | 62 | | return ValidationResult.Error("--participant-ids must contain at least one non-empty participant id when pro |
| | | 63 | | } |
| | | 64 | | |
| | 1 | 65 | | return ValidationResult.Success(); |
| | | 66 | | } |
| | | 67 | | |
| | | 68 | | internal IReadOnlySet<string> GetParticipantIdFilter() |
| | | 69 | | { |
| | 1 | 70 | | return string.IsNullOrWhiteSpace(ParticipantIds) |
| | 1 | 71 | | ? new HashSet<string>(StringComparer.Ordinal) |
| | 1 | 72 | | : ParticipantIds |
| | 1 | 73 | | .Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) |
| | 1 | 74 | | .ToHashSet(StringComparer.Ordinal); |
| | | 75 | | } |
| | | 76 | | } |