Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,28 @@ internal static partial class CreateLoopsCheckpointsValidateCommandApiCommand
Required = true,
};

private static Option<string?> RunId { get; } = new(
name: @"--run-id")
{
Description = @"Loops run whose sampler will load the checkpoint. The checkpoint must use the run's LoRA config.",
};
private static Option<string?> Input { get; } = new(@"--input")
{
Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.",
};

private static Option<string?> RequestJson { get; } = new(@"--request-json")
{
Description = "Request body as JSON.",
Hidden = true,
};

private static Option<string?> RequestFile { get; } = new(@"--request-file")
{
Description = "Path to a JSON request file, or '-' for stdin.",
Hidden = true,
};

private static string FormatResponse(ParseResult parseResult, global::Baseten.ValidateLoopsCheckpointResponseV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
Expand Down Expand Up @@ -41,17 +63,40 @@ public static Command Create(string? commandName = null)
var command = new Command(commandName ?? @"create-loops-checkpoints-validate", @"Validates a Loops checkpoint bt:// URI
Returns whether the caller can manage and use this checkpoint.");
command.Options.Add(CheckpointPath);

command.Options.Add(RunId);
command.Options.Add(Input);
command.Options.Add(RequestJson);
command.Options.Add(RequestFile);
command.Validators.Add(result =>
{
var hasInput = result.GetResult(Input) is not null;
var hasRequestJson = result.GetResult(RequestJson) is not null;
var hasRequestFile = result.GetResult(RequestFile) is not null;
var specifiedCount = (hasInput ? 1 : 0) + (hasRequestJson ? 1 : 0) + (hasRequestFile ? 1 : 0);
if (specifiedCount > 1)
{
result.AddError(@"Specify at most one of --input, --request-json, or --request-file.");
}
});

command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var __requestBase = await CliRuntime.ReadRequestOrDefaultAsync<global::Baseten.ValidateLoopsCheckpointRequestV1>(
parseResult,
Input,
RequestJson,
RequestFile,
global::Baseten.SourceGenerationContext.Default,
cancellationToken).ConfigureAwait(false);
var checkpointPath = parseResult.GetRequiredValue(CheckpointPath);
var runId = CliRuntime.WasSpecified(parseResult, RunId) ? parseResult.GetValue(RunId) : (__requestBase is { } __RunIdBaseValue ? __RunIdBaseValue.RunId : default);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.CreateLoopsCheckpointsValidateAsync(
checkpointPath: checkpointPath,
runId: runId,
cancellationToken: cancellationToken).ConfigureAwait(false);


Expand Down
9 changes: 5 additions & 4 deletions src/cli/Baseten.CLI/Commands/DefaultApiGroupCommand.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,21 @@ public static Command Create()
command.Subcommands.Add(GetModelsByModelIdAuditLogsCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdDeploymentsCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdDeploymentsByDeploymentIdCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdDeploymentsByDeploymentIdColdStartsCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdDeploymentsByDeploymentIdColdStartsSummaryCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdDeploymentsByDeploymentIdConfigCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdDeploymentsByDeploymentIdDownloadCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdDeploymentsByDeploymentIdLogsCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdDeploymentsByDeploymentIdMetricsCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdDeploymentsByDeploymentIdPatchesStateCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdDeploymentsByDeploymentIdStartupsCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdDeploymentsByDeploymentIdStartupsSummaryCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdDeploymentsDevelopmentCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdDeploymentsProductionCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdEnvironmentsCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdEnvironmentsByEnvNameCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdEnvironmentsByEnvNameColdStartsCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdEnvironmentsByEnvNameColdStartsSummaryCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdEnvironmentsByEnvNameLogsCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdEnvironmentsByEnvNameMetricsCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdEnvironmentsByEnvNameStartupsCommandApiCommand.Create());
command.Subcommands.Add(GetModelsByModelIdEnvironmentsByEnvNameStartupsSummaryCommandApiCommand.Create());
command.Subcommands.Add(GetOrganizationsMeCommandApiCommand.Create());
command.Subcommands.Add(GetRegionsCommandApiCommand.Create());
command.Subcommands.Add(GetRoutesCommandApiCommand.Create());
Expand All @@ -202,6 +202,7 @@ public static Command Create()
command.Subcommands.Add(GetRoutesSettingsTeamsByTeamIdUsersCommandApiCommand.Create());
command.Subcommands.Add(GetRoutesSettingsTeamsByTeamIdUsersByUserIdCommandApiCommand.Create());
command.Subcommands.Add(GetRoutesSettingsUsersByUserIdCommandApiCommand.Create());
command.Subcommands.Add(GetRoutesSettingsUsersByUserIdTeamsCommandApiCommand.Create());
command.Subcommands.Add(GetRoutesUsageCommandApiCommand.Create());
command.Subcommands.Add(GetSecretsCommandApiCommand.Create());
command.Subcommands.Add(GetTeamsCommandApiCommand.Create());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Baseten.CLI.Commands;

internal static partial class GetModelsByModelIdDeploymentsByDeploymentIdColdStartsCommandApiCommand
internal static partial class GetModelsByModelIdDeploymentsByDeploymentIdStartupsCommandApiCommand
{
private static Argument<string> ModelId { get; } = new(
name: @"model-id")
Expand Down Expand Up @@ -36,7 +36,7 @@ internal static partial class GetModelsByModelIdDeploymentsByDeploymentIdColdSta
private static Option<int?> MinDurationMs { get; } = new(
name: @"--min-duration-ms")
{
Description = @"Only include cold starts that lasted at least this many milliseconds.",
Description = @"Only include startups that lasted at least this many milliseconds.",
};

private static Option<string?> Cursor { get; } = new(
Expand All @@ -51,13 +51,13 @@ internal static partial class GetModelsByModelIdDeploymentsByDeploymentIdColdSta
Description = @"Maximum number of attempts to return.",
};

private static Option<global::System.Collections.Generic.IList<global::Baseten.ColdStartOutcomeV1>?> Outcomes { get; } = new(
private static Option<global::System.Collections.Generic.IList<global::Baseten.StartupOutcomeV1>?> Outcomes { get; } = new(
name: @"--outcomes")
{
Description = @"Only include attempts with one of these outcomes. Repeat to pass several.",
};

private static Option<global::Baseten.ColdStartPhaseV1?> Phase { get; } = new(
private static Option<global::Baseten.StartupPhaseV1?> Phase { get; } = new(
name: @"--phase")
{
Description = @"Only include attempts that spent longer than 0 ms in this phase.",
Expand All @@ -69,7 +69,7 @@ internal static partial class GetModelsByModelIdDeploymentsByDeploymentIdColdSta
Description = @"Only include attempts whose replica ID matches exactly, or whose deployment name contains this text (case-insensitive).",
};

private static Option<global::Baseten.ColdStartSortFieldV1?> SortBy { get; } = new(
private static Option<global::Baseten.StartupSortFieldV1?> SortBy { get; } = new(
name: @"--sort-by")
{
Description = @"Field to sort attempts by. Defaults to `STARTED_AT`.",
Expand All @@ -81,7 +81,7 @@ internal static partial class GetModelsByModelIdDeploymentsByDeploymentIdColdSta
Description = @"Sort direction. Defaults to `desc`.",
};

private static string FormatResponse(ParseResult parseResult, global::Baseten.ColdStartAttemptsV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
private static string FormatResponse(ParseResult parseResult, global::Baseten.StartupAttemptsV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
CustomizeResponseText(parseResult, value, ref text);
Expand All @@ -97,16 +97,16 @@ private static string FormatResponse(ParseResult parseResult, global::Baseten.Co
return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints);
}

static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.ColdStartAttemptsV1 value, ref string? text);
static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.StartupAttemptsV1 value, ref string? text);
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


static partial void CustomizeCommand(ref Command command);

public static Command Create(string? commandName = null)
{
var command = new Command(commandName ?? @"get-models-by-model-id-deployments-by-deployment-id-cold-starts", @"Lists the cold starts of a model deployment
Lists replica cold starts in the given time range, newest first by default. Pass the `cursor` from a response to fetch the next page.");
var command = new Command(commandName ?? @"get-models-by-model-id-deployments-by-deployment-id-startups", @"Lists the startups of a model deployment
Lists replica startups in the given time range, newest first by default. Pass the `cursor` from a response to fetch the next page.");
command.Arguments.Add(ModelId);
command.Arguments.Add(DeploymentId);
command.Options.Add(StartEpochMillis);
Expand Down Expand Up @@ -139,7 +139,7 @@ await CliRuntime.RunAsync(async () =>
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.GetModelsByModelIdDeploymentsByDeploymentIdColdStartsAsync(
var response = await client.GetModelsByModelIdDeploymentsByDeploymentIdStartupsAsync(
modelId: modelId,
deploymentId: deploymentId,
startEpochMillis: startEpochMillis,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Baseten.CLI.Commands;

internal static partial class GetModelsByModelIdDeploymentsByDeploymentIdColdStartsSummaryCommandApiCommand
internal static partial class GetModelsByModelIdDeploymentsByDeploymentIdStartupsSummaryCommandApiCommand
{
private static Argument<string> ModelId { get; } = new(
name: @"model-id")
Expand Down Expand Up @@ -36,10 +36,10 @@ internal static partial class GetModelsByModelIdDeploymentsByDeploymentIdColdSta
private static Option<int?> MinDurationMs { get; } = new(
name: @"--min-duration-ms")
{
Description = @"Only include cold starts that lasted at least this many milliseconds.",
Description = @"Only include startups that lasted at least this many milliseconds.",
};

private static string FormatResponse(ParseResult parseResult, global::Baseten.ColdStartSummaryV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
private static string FormatResponse(ParseResult parseResult, global::Baseten.StartupSummaryV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
CustomizeResponseText(parseResult, value, ref text);
Expand All @@ -55,16 +55,16 @@ private static string FormatResponse(ParseResult parseResult, global::Baseten.Co
return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints);
}

static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.ColdStartSummaryV1 value, ref string? text);
static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.StartupSummaryV1 value, ref string? text);
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


static partial void CustomizeCommand(ref Command command);

public static Command Create(string? commandName = null)
{
var command = new Command(commandName ?? @"get-models-by-model-id-deployments-by-deployment-id-cold-starts-summary", @"Gets the cold start summary for a model deployment
Gets the distribution of replica cold start durations, in total and per phase, in the given time range.");
var command = new Command(commandName ?? @"get-models-by-model-id-deployments-by-deployment-id-startups-summary", @"Gets the startup summary for a model deployment
Gets the distribution of replica startup durations, in total and per phase, in the given time range.");
command.Arguments.Add(ModelId);
command.Arguments.Add(DeploymentId);
command.Options.Add(StartEpochMillis);
Expand All @@ -83,7 +83,7 @@ await CliRuntime.RunAsync(async () =>
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.GetModelsByModelIdDeploymentsByDeploymentIdColdStartsSummaryAsync(
var response = await client.GetModelsByModelIdDeploymentsByDeploymentIdStartupsSummaryAsync(
modelId: modelId,
deploymentId: deploymentId,
startEpochMillis: startEpochMillis,
Expand Down
Loading
Loading