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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
30 changes: 27 additions & 3 deletions cmd/root_cmd/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ type pushInputs struct {
batch string
overwriteVersionRef string
updateParts []string
// noVisualization opts out of the visualize_samples step in the engine
// when evaluating. Only meaningful alongside --eval / -u, since those
// are the paths that dispatch an evaluate job.
noVisualization bool
}

type pushState struct {
Expand Down Expand Up @@ -75,6 +79,9 @@ Examples:

# Refresh multiple artifacts in one run
leap push -o my-model -u visualization -u insights

# Push + evaluate without running the visualizations step (faster — no dashboard samples)
leap push -e --novis
`,
RunE: func(cmd *cobra.Command, args []string) error {
return runPush(cmd.Context(), in)
Expand All @@ -94,6 +101,7 @@ Examples:
cmd.Flags().StringVar(&in.overwriteVersionRef, "overwrite-version", "", "")
_ = cmd.Flags().MarkDeprecated("overwrite-version", "use --overwrite (-o) instead")
cmd.Flags().StringSliceVarP(&in.updateParts, "update", "u", nil, "What changed in the code on overwrite (repeatable; implies --eval; skips the prompt). Values: metadata, metric, metric_direction, insights, visualization (viz). metadata+metric trigger a full re-evaluation.")
cmd.Flags().BoolVar(&in.noVisualization, "novis", false, "Skip the visualize_samples step on the subsequent evaluate (requires --eval / -u)")
return cmd
}

Expand Down Expand Up @@ -244,6 +252,12 @@ func validatePushInputs(in *pushInputs) error {
if len(in.updateParts) > 0 && !in.runEval {
in.runEval = true
}
// --novis only makes sense when we're actually going to evaluate.
// --update implies --eval (set above), so we just check the final
// resolved runEval state.
if in.noVisualization && !in.runEval {
return fmt.Errorf("--novis requires --eval (-e) or --update (-u)")
}
return nil
}

Expand All @@ -260,6 +274,7 @@ func newPushState(ctx context.Context, in *pushInputs) (*pushState, error) {
"model_path": in.modelPath,
"overwrite_version_ref": in.overwriteVersionRef,
"update_parts": in.updateParts,
"no_visualization": in.noVisualization,
}
s := &pushState{ctx: ctx, inputs: in, properties: properties}

Expand Down Expand Up @@ -374,6 +389,11 @@ type evalDispatch struct {
updateActions []tensorleapapi.UpdateAction
runUpdateEvaluate bool
persistOnly bool
// noVisualization mirrors the CLI --novis flag; threaded through to
// the evaluate API call so the engine marks visualize_samples SKIPPED.
// Only consulted on the RunEvaluate path — update-evaluate-artifact
// has no visualization step to skip.
noVisualization bool
}

func (s *pushState) resolveEvalPlan() (evalDispatch, error) {
Expand All @@ -387,7 +407,7 @@ func (s *pushState) resolveEvalPlan() (evalDispatch, error) {
return evalDispatch{}, nil
}
batchSize, err := s.askOrDefaultBatchSize()
return evalDispatch{batchSize: batchSize}, err
return evalDispatch{batchSize: batchSize, noVisualization: in.noVisualization}, err
}

plan, err := s.resolveOverwriteEvalPlan()
Expand All @@ -401,7 +421,11 @@ func (s *pushState) resolveEvalPlan() (evalDispatch, error) {

if plan.Kind == model.EvaluatePlanReset {
batchSize, err := s.askOrDefaultBatchSize()
return evalDispatch{batchSize: batchSize, updateActions: plan.UpdateActions}, err
return evalDispatch{
batchSize: batchSize,
updateActions: plan.UpdateActions,
noVisualization: in.noVisualization,
}, err
}
return evalDispatch{updateActions: plan.UpdateActions, runUpdateEvaluate: true}, nil
}
Expand Down Expand Up @@ -498,7 +522,7 @@ func (s *pushState) triggerEvaluate(versionId string, dispatch evalDispatch) err
}
return nil
}
if err := model.RunEvaluate(s.ctx, s.projectId(), versionId, dispatch.batchSize); err != nil {
if err := model.RunEvaluate(s.ctx, s.projectId(), versionId, dispatch.batchSize, dispatch.noVisualization); err != nil {
return fmt.Errorf("failed to run evaluation: %w", err)
}
return nil
Expand Down
5 changes: 4 additions & 1 deletion pkg/model/evaluate.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,16 @@ func HasEvaluatedAncestorOrSelf(ctx context.Context, projectId, versionId string
return false, nil
}

func RunEvaluate(ctx context.Context, projectId, versionId string, batchSize int) error {
func RunEvaluate(ctx context.Context, projectId, versionId string, batchSize int, noVisualization bool) error {
existingVersionParams := tensorleapapi.NewEvaluateExistingVersionParams(
versionId,
projectId,
float64(batchSize),
0,
)
if noVisualization {
existingVersionParams.SetNoVisualization(true)
}

evaluateParams := tensorleapapi.EvaluateParams{
EvaluateExistingVersionParams: existingVersionParams,
Expand Down
2 changes: 2 additions & 0 deletions pkg/tensorleapapi/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ docs/SettingValue.md
docs/SettingsAndValuesWrapper.md
docs/SettingsCategory.md
docs/SeverityMetricElement.md
docs/SimulationInstance.md
docs/SingleUserModeSettings.md
docs/SlimTeam.md
docs/SlimUserData.md
Expand Down Expand Up @@ -951,6 +952,7 @@ model_setting_value.go
model_settings_and_values_wrapper.go
model_settings_category.go
model_severity_metric_element.go
model_simulation_instance.go
model_single_user_mode_settings.go
model_slim_team.go
model_slim_user_data.go
Expand Down
3 changes: 2 additions & 1 deletion pkg/tensorleapapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/opena
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 11.0.90
- API version: 11.0.91
- Package version: 1.0.0
- Generator version: 7.14.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Expand Down Expand Up @@ -692,6 +692,7 @@ Class | Method | HTTP request | Description
- [SettingsAndValuesWrapper](docs/SettingsAndValuesWrapper.md)
- [SettingsCategory](docs/SettingsCategory.md)
- [SeverityMetricElement](docs/SeverityMetricElement.md)
- [SimulationInstance](docs/SimulationInstance.md)
- [SingleUserModeSettings](docs/SingleUserModeSettings.md)
- [SlimTeam](docs/SlimTeam.md)
- [SlimUserData](docs/SlimUserData.md)
Expand Down
Loading
Loading