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
  •  
  •  
  •  
42 changes: 36 additions & 6 deletions cmd/root_cmd/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ Examples:

# Overwrite + name what changed (implies --eval; skips the prompt)
leap push -o my-model -u viz
leap push -o my-model -u metric_direction
leap push -o my-model -u metric_config
leap push -o my-model -u metric # triggers a full re-evaluation

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

# Push + evaluate without running the visualizations step (faster — no dashboard samples)
leap push -e --novis
Expand All @@ -106,7 +106,7 @@ Examples:
cmd.Flags().StringVarP(&in.overwriteVersionRef, "overwrite", "o", "", "Overwrite an existing version (id, or name — picker shown if name is ambiguous)")
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().StringSliceVarP(&in.updateParts, "update", "u", nil, "What changed in the code on overwrite (repeatable; implies --eval; skips the prompt). Values: metadata, metric, metric_config, 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)")
cmd.Flags().BoolVar(&in.yes, "yes", false, "Acknowledge pre-push warnings and proceed without prompting")
return cmd
Expand Down Expand Up @@ -456,20 +456,38 @@ func (s *pushState) resolveEvalPlan() (evalDispatch, error) {
}

if !s.isOverwrite {
// New version → a full evaluate. Offer to run it (default Yes).
if !in.runEval {
return evalDispatch{}, nil
run, err := s.promptRunEvaluate(false)
if err != nil {
return evalDispatch{}, err
}
if !run {
return evalDispatch{}, nil
}
in.runEval = true
}
batchSize, err := s.askOrDefaultBatchSize()
return evalDispatch{batchSize: batchSize, noVisualization: in.noVisualization}, err
}

// Overwrite → ask what changed first; that decides whether the run would be
// an update-evaluate or a full re-evaluate. Then offer to run it (default
// Yes), labelling the prompt accordingly.
plan, err := s.resolveOverwriteEvalPlan()
if err != nil {
return evalDispatch{}, err
}

if !in.runEval {
return evalDispatch{updateActions: plan.UpdateActions, persistOnly: true}, nil
run, err := s.promptRunEvaluate(plan.Kind == model.EvaluatePlanUpdate)
if err != nil {
return evalDispatch{}, err
}
if !run {
return evalDispatch{updateActions: plan.UpdateActions, persistOnly: true}, nil
}
in.runEval = true
}

if plan.Kind == model.EvaluatePlanReset {
Expand All @@ -483,12 +501,24 @@ func (s *pushState) resolveEvalPlan() (evalDispatch, error) {
return evalDispatch{updateActions: plan.UpdateActions, runUpdateEvaluate: true}, nil
}

// promptRunEvaluate offers to run evaluation after the push (default Yes) when
// the user didn't pass --eval (or -u, which implies it). isUpdateEvaluate picks
// the label ("update-evaluate" vs "evaluate"). Returns false without prompting
// when stdin isn't a terminal, so scripted/piped pushes keep the explicit
// --eval requirement.
func (s *pushState) promptRunEvaluate(isUpdateEvaluate bool) (bool, error) {
if !term.IsTerminal(int(os.Stdin.Fd())) {
return false, nil
}
return model.AskRunEvaluate(isUpdateEvaluate)
}

func (s *pushState) resolveOverwriteEvalPlan() (model.EvaluatePlan, error) {
plan, err := s.collectUserUpdatePlan()
if err != nil {
return model.EvaluatePlan{}, err
}
if s.inputs.runEval && plan.Kind == model.EvaluatePlanUpdate && !s.canUpdateEvaluate() {
if plan.Kind == model.EvaluatePlanUpdate && !s.canUpdateEvaluate() {
log.Info("No evaluation data found in the override chain — running a fresh evaluate.")
return model.EvaluatePlan{Kind: model.EvaluatePlanReset, UpdateActions: plan.UpdateActions}, nil
}
Expand Down
52 changes: 29 additions & 23 deletions pkg/model/evaluate.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,15 @@ func AskForBatchSize(defaultBatchSize int) (int, error) {
}

var updateActionAliases = map[string]tensorleapapi.UpdateAction{
"metadata": tensorleapapi.UPDATEACTION_UPDATE_METADATA,
"metric": tensorleapapi.UPDATEACTION_UPDATE_METRIC,
"metric_direction": tensorleapapi.UPDATEACTION_UPDATE_METRIC_DIRECTION,
"metric-direction": tensorleapapi.UPDATEACTION_UPDATE_METRIC_DIRECTION,
"direction": tensorleapapi.UPDATEACTION_UPDATE_METRIC_DIRECTION,
"insights": tensorleapapi.UPDATEACTION_UPDATE_INSIGHTS,
"visualization": tensorleapapi.UPDATEACTION_UPDATE_VISUALIZATION,
"viz": tensorleapapi.UPDATEACTION_UPDATE_VISUALIZATION,
"metadata": tensorleapapi.UPDATEACTION_UPDATE_METADATA,
"metric": tensorleapapi.UPDATEACTION_UPDATE_METRIC,
"metric_config": tensorleapapi.UPDATEACTION_UPDATE_METRIC_CONFIG,
"metric-config": tensorleapapi.UPDATEACTION_UPDATE_METRIC_CONFIG,
"visualization": tensorleapapi.UPDATEACTION_UPDATE_VISUALIZATION,
"viz": tensorleapapi.UPDATEACTION_UPDATE_VISUALIZATION,
}

const updateActionAllowedHint = "metadata, metric, metric_direction, insights, visualization, viz"
const updateActionAllowedHint = "metadata, metric, metric_config, visualization, viz"

func ParseUpdateActionsFromFlags(parts []string) ([]tensorleapapi.UpdateAction, error) {
if len(parts) == 0 {
Expand Down Expand Up @@ -136,9 +134,8 @@ type ChangeKey int
const (
ChangeMetadata ChangeKey = iota
ChangeMetric
ChangeMetricDirection
ChangeMetricConfig
ChangeVisualization
ChangeInsights
)

type changeOption struct {
Expand All @@ -162,20 +159,16 @@ var changeOptions = []changeOption{
action: tensorleapapi.UPDATEACTION_UPDATE_METRIC,
},
{
key: ChangeMetricDirection,
label: "Metric direction",
action: tensorleapapi.UPDATEACTION_UPDATE_METRIC_DIRECTION,
key: ChangeMetricConfig,
label: "Metric config",
hint: "metric direction + insights",
action: tensorleapapi.UPDATEACTION_UPDATE_METRIC_CONFIG,
},
{
key: ChangeVisualization,
label: "Visualizations",
action: tensorleapapi.UPDATEACTION_UPDATE_VISUALIZATION,
},
{
key: ChangeInsights,
label: "Insights",
action: tensorleapapi.UPDATEACTION_UPDATE_INSIGHTS,
},
}

func triggersFullReeval(a tensorleapapi.UpdateAction) bool {
Expand Down Expand Up @@ -226,6 +219,21 @@ func init() {
{{- end}}`
}

// AskRunEvaluate offers to run evaluation after a push (default Yes). The label
// reflects whether the run will be an update-evaluate or a full evaluate.
func AskRunEvaluate(isUpdateEvaluate bool) (bool, error) {
msg := "Run evaluate after push?"
if isUpdateEvaluate {
msg = "Run update-evaluate after push?"
}
run := true
prompt := &survey.Confirm{Message: msg, Default: true}
if err := survey.AskOne(prompt, &run); err != nil {
return false, err
}
return run, nil
}

func AskForEvaluatePlan() (EvaluatePlan, error) {
labels := make([]string, len(changeOptions))
labelToKey := make(map[string]ChangeKey, len(changeOptions))
Expand Down Expand Up @@ -266,10 +274,8 @@ func FormatEvaluatePlan(plan EvaluatePlan) []string {
out := make([]string, 0, len(plan.UpdateActions))
for _, a := range plan.UpdateActions {
switch a {
case tensorleapapi.UPDATEACTION_UPDATE_METRIC_DIRECTION:
out = append(out, "Update metric direction")
case tensorleapapi.UPDATEACTION_UPDATE_INSIGHTS:
out = append(out, "Regenerate insights")
case tensorleapapi.UPDATEACTION_UPDATE_METRIC_CONFIG:
out = append(out, "Update metric config", "Regenerate insights")
case tensorleapapi.UPDATEACTION_UPDATE_VISUALIZATION:
out = append(out, "Regenerate visualizations")
default:
Expand Down
2 changes: 1 addition & 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.95
- API version: 11.0.100
- Package version: 1.0.0
- Generator version: 7.14.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Expand Down
32 changes: 8 additions & 24 deletions pkg/tensorleapapi/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ info:
license:
name: SEE LICENSE IN LICENSE.md
title: node-server
version: 11.0.95
version: 11.0.100
servers:
- url: /api/v2
paths:
Expand Down Expand Up @@ -13207,9 +13207,8 @@ components:
enum:
- update_metadata
- update_metric
- update_metric_direction
- update_metric_config
- update_visualization
- update_insights
type: string
UpdateEvaluateArtifactParams:
additionalProperties: true
Expand Down Expand Up @@ -34835,7 +34834,6 @@ components:
population_exploration_digest_seed_count: 6.027456183070403
inference_artifact_id: inference_artifact_id
es_inspection_index: es_inspection_index
insights_index_counter: 1.4658129805029452
vis_resources:
insights_revision: insights_revision
sample_visualizers_revision: sample_visualizers_revision
Expand All @@ -34860,9 +34858,6 @@ components:
population_exploration_digest_seed_count:
format: double
type: number
insights_index_counter:
format: double
type: number
csv_blob_path:
type: string
overrided_version_id:
Expand Down Expand Up @@ -34979,7 +34974,7 @@ components:
updateActions:
- update_metadata
- update_metadata
serialNumber: 5.962133916683182
serialNumber: 1.4658129805029452
resources:
overrided_version_id: overrided_version_id
inference_resources:
Expand All @@ -34989,7 +34984,6 @@ components:
population_exploration_digest_seed_count: 6.027456183070403
inference_artifact_id: inference_artifact_id
es_inspection_index: es_inspection_index
insights_index_counter: 1.4658129805029452
vis_resources:
insights_revision: insights_revision
sample_visualizers_revision: sample_visualizers_revision
Expand Down Expand Up @@ -35204,7 +35198,7 @@ components:
updateActions:
- update_metadata
- update_metadata
serialNumber: 5.962133916683182
serialNumber: 1.4658129805029452
resources:
overrided_version_id: overrided_version_id
inference_resources:
Expand All @@ -35214,7 +35208,6 @@ components:
population_exploration_digest_seed_count: 6.027456183070403
inference_artifact_id: inference_artifact_id
es_inspection_index: es_inspection_index
insights_index_counter: 1.4658129805029452
vis_resources:
insights_revision: insights_revision
sample_visualizers_revision: sample_visualizers_revision
Expand Down Expand Up @@ -35560,7 +35553,6 @@ components:
population_exploration_digest_seed_count: 6.027456183070403
inference_artifact_id: inference_artifact_id
es_inspection_index: es_inspection_index
insights_index_counter: 1.4658129805029452
vis_resources:
insights_revision: insights_revision
sample_visualizers_revision: sample_visualizers_revision
Expand Down Expand Up @@ -35865,7 +35857,6 @@ components:
population_exploration_digest_seed_count: 6.027456183070403
inference_artifact_id: inference_artifact_id
es_inspection_index: es_inspection_index
insights_index_counter: 1.4658129805029452
vis_resources:
insights_revision: insights_revision
sample_visualizers_revision: sample_visualizers_revision
Expand Down Expand Up @@ -36077,7 +36068,6 @@ components:
population_exploration_digest_seed_count: 6.027456183070403
inference_artifact_id: inference_artifact_id
es_inspection_index: es_inspection_index
insights_index_counter: 1.4658129805029452
vis_resources:
insights_revision: insights_revision
sample_visualizers_revision: sample_visualizers_revision
Expand Down Expand Up @@ -36311,7 +36301,6 @@ components:
population_exploration_digest_seed_count: 6.027456183070403
inference_artifact_id: inference_artifact_id
es_inspection_index: es_inspection_index
insights_index_counter: 1.4658129805029452
vis_resources:
insights_revision: insights_revision
sample_visualizers_revision: sample_visualizers_revision
Expand Down Expand Up @@ -36523,7 +36512,6 @@ components:
population_exploration_digest_seed_count: 6.027456183070403
inference_artifact_id: inference_artifact_id
es_inspection_index: es_inspection_index
insights_index_counter: 1.4658129805029452
vis_resources:
insights_revision: insights_revision
sample_visualizers_revision: sample_visualizers_revision
Expand Down Expand Up @@ -36757,7 +36745,6 @@ components:
population_exploration_digest_seed_count: 6.027456183070403
inference_artifact_id: inference_artifact_id
es_inspection_index: es_inspection_index
insights_index_counter: 1.4658129805029452
vis_resources:
insights_revision: insights_revision
sample_visualizers_revision: sample_visualizers_revision
Expand Down Expand Up @@ -36969,7 +36956,6 @@ components:
population_exploration_digest_seed_count: 6.027456183070403
inference_artifact_id: inference_artifact_id
es_inspection_index: es_inspection_index
insights_index_counter: 1.4658129805029452
vis_resources:
insights_revision: insights_revision
sample_visualizers_revision: sample_visualizers_revision
Expand Down Expand Up @@ -37338,7 +37324,6 @@ components:
population_exploration_digest_seed_count: 6.027456183070403
inference_artifact_id: inference_artifact_id
es_inspection_index: es_inspection_index
insights_index_counter: 1.4658129805029452
vis_resources:
insights_revision: insights_revision
sample_visualizers_revision: sample_visualizers_revision
Expand Down Expand Up @@ -37550,7 +37535,6 @@ components:
population_exploration_digest_seed_count: 6.027456183070403
inference_artifact_id: inference_artifact_id
es_inspection_index: es_inspection_index
insights_index_counter: 1.4658129805029452
vis_resources:
insights_revision: insights_revision
sample_visualizers_revision: sample_visualizers_revision
Expand Down Expand Up @@ -40340,6 +40324,7 @@ components:
additionalProperties: true
example:
jobId: jobId
digest: digest
readyArtifacts:
scatter: scatter
status: UNSTARTED
Expand All @@ -40350,7 +40335,10 @@ components:
type: string
readyArtifacts:
$ref: "#/components/schemas/Partial_PopulationExplorationArtifacts_"
digest:
type: string
required:
- digest
- readyArtifacts
- status
type: object
Expand Down Expand Up @@ -40781,7 +40769,6 @@ components:
useCustomLatentSpace: true
forceExecute: true
versionId: versionId
digest: digest
numOfSamples: 6.027456183070403
notApplyTimeFilterOnUnlabeledOnly: true
balanceBy:
Expand Down Expand Up @@ -41015,8 +41002,6 @@ components:
$ref: "#/components/schemas/ESFilter"
notApplyTimeFilterOnUnlabeledOnly:
type: boolean
digest:
type: string
numOfSamples:
format: double
type: number
Expand All @@ -41041,7 +41026,6 @@ components:
required:
- balanceBy
- batchSize
- digest
- numOfSamples
- projectId
- reductionAlgorithm
Expand Down
2 changes: 1 addition & 1 deletion pkg/tensorleapapi/api_default.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading